How to hide unread SMS notification?

411 Views Asked by At

I'm writing application which handles SMS's and as I plan it should replace stock/default application.

I'm intercepting android.provider.Telephony.SMS_RECEIVED broadcast fired by incoming SMS and publishing my own notification and then calling abortBroadcast(), so in the end there is no notification for incoming new messages which leads to default/stock app.

But the problem is in fact that when user doesn't read for a long enough time (smth like several minutes) incoming SMS stock/default app aroses another broadcast - I suspect just checking that there's unread sms. So user sees 2 notifications: one from default/stock messaging app and another one from mines, which is messing.

I can't find which broadcast fired when there's unread sms?

Any ideas, hints?

1

There are 1 best solutions below

1
On

You can set the priority of your receiver this way, so you know that it has the top priority and will execute the onReceive() method:

<receiver android:name=".SmsReceiver" android:enabled="true"
    android:exported="true" android:priority="999">
    <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>