0

I have implemented an SMS receiver which intercepts incoming SMS messages without any issues. However, when I install GO SMS Pro and set "Disable other message notification", then my app does not receive any broadcast message even though I have set the priority on intent filter very high. Is there a way to overcome so that my app always receive a SMS broadcast irrespective of what user does on Go SMS Pro's app, especially since my app does not show any UI pop-up notification? As soon as I uninstall GO SMS Pro, my app starts getting incoming SMS broadcasts and works fine.

Here is the log when an incoming SMS is received and GO SMS Pro is installed. There is some magic done by GO SMS Pro which I don't understand. Can someone explain what is done here and how can I make sure my app does get ordered broadcast notification every time.

2 Answers2

1

add following code in your manifest in broadcast receiver declaration

<receiver
        android:name="com.application.reciever.SMSReceiver"
        class="com.application.reciever.SMSReceiver" android:exported="true">
     <intent-filter android:priority="999" >
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        </intent-filter>
</receiver>

"The value must be an integer, such as "100". Higher numbers have a higher priority."

Hope it will help you.

Sanket Shah
  • 4,352
  • 3
  • 21
  • 41
0

GO SMS have set their on absolute maximum of 2147483647 (2^31-1). So if you set it same priority then in that case Android OS will pass broadcast to older app i.e (first installed app) would get the notification.If Go SMS Pro is installed prior to your app you should warn your users about the situation. They could configure Go SMS Pro differently or uninstall it and then re install it again so your app can work too.

<receiver android:name=".SMSReceiver" > 
    <intent-filter android:priority="2147483647"> 
        <action android:name="android.provider.Telephony.SMS_RECEIVED" /> 
    </intent-filter> 
</receiver>

Then in SMSReceiver onReceive() you need to add abortBroadcast() to abort any further Broadcasts

public void onReceive(Context context, Intent intent) {
  abortBroadcast();
}
Ayush
  • 3,989
  • 1
  • 26
  • 34
  • This is an interesting theory, but my app was installed before GoSMS and I have the highest priority 2147483647 (2^31-1) and GoSMS is receiving the broadcast receiver before my app and aborting it. – evermeire Dec 21 '13 at 00:06