Android Tutorial Intent Filters - Intercepting SMS messages in the background

Status
Not open for further replies.

Bangdido

Member
Licensed User
Longtime User
Hello Erel.

i have problems with this inssue,
following the tutorial, I made an application to intercept sms,
BUT it seems that is not working,

the SMS arrives first (i see the OS notification) and then the interceptor get the sms, how can i hide the notification?

this is my code.
p.d. the device have android 4.4.2

B4X:
Main Activity
Sub Activity_Create(FirstTime As Boolean)
  StartService(Servicio)
End Sub

Service
#Region  Service Attributes
   #StartAtBoot: True
#End Region

Sub Process_Globals
  Dim N As Notification
  Dim SI As SmsInterceptor
End Sub

Sub Service_Create
  Log("Servicio SMS Interceptor Creado")
  ' Establecimiento de las Propiedades de Notificación
  N.Initialize
  N.Icon  = "icon"
  N.Sound  = False
  N.Vibrate  = False
  N.Light  = False
  N.OnGoingEvent = True
  N.SetInfo("GPS Guardian", "GPS Guardian v1.0", Main)
  N.Notify(1)
   Service.StartForeground(1,N)
   SI.Initialize2("SI",2147483647)
End Sub

Sub Service_Start (StartingIntent As Intent)
  Log("Servicio SMS Interceptor Iniciado")
End Sub

Sub Service_Destroy
  Log("Servicio SMS Interceptor Destruido")
  N.Cancel(1)
End Sub

Sub SI_MessageReceived (From As String, Body As String) As Boolean
  Dim Rst As Boolean
   Rst = False
  If From="5050" Then  ' Is the SMS what i need ?
    Rst = True
    Log("Interceptando SMS desde " & From & " - " & Body)
   Else
    Log("SMS desde "  & From & " - " & Body)
   End If
   Return(Rst)
End Sub
 
Last edited:

fransvlaarhoven

Active Member
Licensed User
Longtime User
Hallo,

is there a way to register an app in such a way that it becomes "the home app", the first app to start after the system boots?

Maybe with a static receiver in the manifest?
 

koaunglay

Member
Licensed User
Longtime User

Hi Erel! I'm trying block incoming sms. But I can't.
Please see this post
http://stackoverflow.com/questions/11194330/b-incoming-texts-android
And teach me please how to use in B4a. I don't understand Eclipse code. So help me Erel or somebody. Please!
 

John Decowski

Member
Licensed User
Longtime User
I want to check my database for updates even while the app is closed and then send a notification to user of a new message. What is the best approach using this technique?
 

John Decowski

Member
Licensed User
Longtime User
I notice this example for phone sms intent. How can i modify manifest to call program every so often? I want my app to refresh its data every 5 minutes even when app is closed. I know a lot of users close apps. I noticed the manifest file listed above calls upon phone sms how would i modify to call my app after a time delay instead?
Thanks really appreciate it guys!
 

BarryW

Active Member
Licensed User
Longtime User
can we intercept message even if the service is been stop on android settings (force stop)... Tnx...
 

haddad

Member
Licensed User
Longtime User
hello ,

i want to send data ( login an password ) from activity A to activity B with intent how can i do ?

thinks
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…