Search code examples
androidsmsbroadcastreceiver

Block Go sms to get sms broadcast


I have a sms broad cast listener, defined in manisfest as:

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

When my phone has Go sms installed. When an sms is received, both the receivers work however I dont want Go sms to work. My app is the first app to be installed in the phone, hence that receiver is called first. Also, I am aborting the broadcast in my listener as:

if (isDelete()) {
    abortBroadcast();
}

I have checked out this sof question, but nothing seems to work.

Also, a bit of confusion about a warning I am getting, which might be causing this ambiguity. On the first line of receiver declaration in manifest, i.e.

<receiver android:name=".CustomSmsListener" >

i get following warning

Exported receiver does not require permission


Solution

  • use android:priority="999" i guess this is the last limit of priority

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