Android Question SMS Interceptor

b4auser1

Well-Known Member
Licensed User
Longtime 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 ?
 

DonManfred

Expert
Licensed User
Longtime User
without seeing what you did in your code an your manifest it is nearly impossible to give congrete answers
 
Upvote 0

b4auser1

Well-Known Member
Licensed User
Longtime 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")
...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime 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

  • smsintercept.zip
    7 KB · Views: 163
Last edited:
Upvote 0
Top