Android Question sms interceptor

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi all!
I want to intercept an SMS on a service module but not working.
not intercept the SMS, I could say that I'm doing wrong?
Deputy code.
greeting
B4X:
#Region  Service Attributes
    #StartAtBoot: true
  
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Dim SI As SmsInterceptor
Dim audio1 As MediaPlayer

End Sub

Sub Service_Create
SI.Initialize2("SI",999)
audio1.Initialize
End Sub

Sub Service_Start (StartingIntent As Intent)
'startServiceAt("",DateTime.Now + 0.1 *DateTime.TicksPerMinute,False)

End Sub

Sub Service_Destroy

End Sub

Sub SI_MessageReceived (From As String, Body As String) As Boolean
    ToastMessageShow("1:" &From,True)
If From ="1140256152" Then
    ToastMessageShow(From,True)
    audio1.Load(File.DirAssets,"AUD2.mp3")
    audio1.SetVolume(1,1)
    audio1.Play
  
End If
  
End Sub

in module main

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
   
   
    Activity.LoadLayout("inicio")
    Activity.Title = "CEPRAL"


    StartService(sms_inter)
end sub
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…