Reputation: 9509
I'm making an Android app that automatically responds to incoming SMS messages. It detects incoming SMS messages with a BroadcastReceiver
as follows in AndroidManifest.xml
<receiver android:name=".receiver.SMSBroadcastReceiver" >
<intent-filter android:priority="1000" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
where SMSBroadcastReceiver
is as follows
public class SMSBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
// code here to deal with message etc.
}
}
This is all working and fine. The problem occurs when I install Facebook Messenger and check both "Turn On Text Messaging" and "Use as main texting App" like so:
With these settings onReceive(Context context, Intent intent)
is now never called, and so for people who use this or another 3rd party SMS app, my app doesn't work!
I've realised it may be the case that abortBroadcast();
is being called by fbook before it gets to my application if it's got a higher priority, but I've set priority to the maximum of 1000 already.
Upvotes: 0
Views: 885
Reputation: 1007228
I've realised it may be the case that abortBroadcast(); is being called by fbook before it gets to my application if it's got a higher priority, but I've set priority to the maximum of 1000 already.
That's not the maximum. That's what the documentation says is the maximum. The maximum is 2,147,483,647 or so (maximum positive integer).
It is impractical for you to have higher priority than every other SMS client, simply because anyone can declare theirs to be the maximum. Simply advise your users that other SMS apps may interfere with yours.
Upvotes: 1