Android Question SMS Interceptor

b4auser1

Well-Known Member
Licensed User
I have created SMS Interceptor using service. Service called once for each SMS on emulator, but 3 times for each SMS on RAZR i Android 4.1.2. It's a bug/feature of Android implementation on RAZR i or it's possible correct behavior ?
 

b4auser1

Well-Known Member
Licensed User
I use static approach:
B4X:
AddReceiverText(svcSMSReceiver,
<intent-filter>
    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>)
B4X:
Sub Service_Start (StartingIntent As Intent)   
...
    If StartingIntent.Action = "android.provider.Telephony.SMS_RECEIVED" Then
Log("SMS received")
...
 

DonManfred

Expert
Licensed User
Maybe it´s the same issue like here!?

This works here... And the service is started only once. Maybe it´s an issue with your device

B4X:
Sub Process_Globals
    Dim lastIntent As Intent
End Sub
B4X:
Sub Service_Start(startingIntent As Intent)
    Log("Service_Start("&startingIntent&")")
    If startingIntent <> lastIntent Then
        Log("New intent")
        lastIntent = startingIntent
        If startingIntent.Action = "android.provider.Telephony.SMS_RECEIVED" Then
      Dim messages() As Message
      messages = ParseSmsIntent(startingIntent)
      For i = 0 To messages.Length - 1
         Log(messages(i))
      Next
       End If
    End If
End Sub
 

Attachments

Last edited:
Top