ask for help with SmsInterceptor

icefairy333

Active Member
Licensed User
Longtime User
the SmsInterceptor didn't work at all.
B4X:
'Service module 拦截短信用的
 Sub Process_Globals
     Type Message (Address As String, Body As String)
     Dim cipher As String
     cipher="AAA"
  
    Dim m As Message
  
 End Sub
 Sub Service_Create
    Dim pi As SmsInterceptor
 Log("s1 create")
 ToastMessageShow("s1 create",True)
    pi.Initialize2("sms",999)
  
    
 End Sub
   
 Sub Service_Destroy
 
  
 
 End Sub
 
 Sub sms_MessageReceived (From As String, Body As String) As Boolean
    ToastMessageShow("adr:"&From&" content:"&Body,True)
    If Body.IndexOf(cipher)>-1 Then
          m.Initialize
          m.Address=From
          m.Body=Body
          Log(m)
           
          'eat the event
          ToastMessageShow("吃掉事件",True)
          Return True
    End If
    'not eat the event
    ToastMessageShow("不吃事件",True)
    Return False
 End Sub
  
 Sub Service_Start(startingIntent As Intent)
  Log("start")
   
 End Sub
:BangHead: when running it ,I send a sms of"AAA",the service didn't execute the sms_MessageReceived sub,there is "start" string in the log :sign0085::sign0085:
 

icefairy333

Active Member
Licensed User
Longtime User
yes, but no matter the third part app running or not (including the service )this app can not receive the message,when the non-system sms app running the sms will handle by the third part app,when it didn't running the sms handle by the system.what's wrong with me ?on the device has active defense application is it matter ? If so the non-system app can receive the sms ~ in the manifest xml I had register an receiver but when the sms arrived the service didn't be active
 
Upvote 0

icefairy333

Active Member
Licensed User
Longtime User
I know that,in the manifestxml there are "receiver","permission" and all necessary object,and in the avd it works well,but on devices didn't work,I have test unistall the active defense(LBE security) app,and restart device, It doesn't work either.No need to change code it can work with avd
 
Upvote 0
Top