Forgive me if I'm missing something obvious, but I'm attempting to implement the model Erel posted (here: https://www.b4x.com/android/forum/t...cepting-sms-messages-in-the-background.20103/ and here https://www.b4x.com/android/forum/t...t-notification-android-4-4.37171/#post-227969) and I'm getting what I consider to be odd behavior.
I've added the manifest code for default messaging app and added the three services (right now the services just log the action and extras they receive).
If I do not create and initialize an SMSInteceptor in the service class I never see any of the intents come across to my class (i.e. my service_start never fires).
If, however, I create an SMSInterceptor object in the class and add a handler to use it, I see the intent come through to my class, and then the SMS_MessageReceived for the interceptor event fires. Relevant manifest code:
I thought if your app is acting as the default messaging app you could just handle everything through the classes and not have to use an SmsInterceptor object?
I've added the manifest code for default messaging app and added the three services (right now the services just log the action and extras they receive).
If I do not create and initialize an SMSInteceptor in the service class I never see any of the intents come across to my class (i.e. my service_start never fires).
If, however, I create an SMSInterceptor object in the class and add a handler to use it, I see the intent come through to my class, and then the SMS_MessageReceived for the interceptor event fires. Relevant manifest code:
B4X:
SetReceiverAttribute(mqtextsmsr, android:permission, "android.permission.BROADCAST_SMS")
AddReceiverText(mqtextsmsr, <intent-filter>
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
)
SetReceiverAttribute(mqtextmmsr, android:permission, "android.permission.BROADCAST_WAP_PUSH")
AddReceiverText(mqtextmmsr, <intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
)
SetServiceAttribute(mqtextrespondvia, android:permission, "android.permission.SEND_RESPOND_VIA_MESSAGE")
SetServiceAttribute(mqtextrespondvia, android:exported, "true")
AddServiceText(mqtextrespondvia, <intent-filter>
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
)
AddActivityText(main,
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
)
I thought if your app is acting as the default messaging app you could just handle everything through the classes and not have to use an SmsInterceptor object?