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 ?
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