Android Connection Notification

I want to delete a notification when an SMS arrives in a shared mailbox. is it possible ... if so, how ... I got a lot of sites where there is metion, this is not possible with the help of code ...

+3
source share
2 answers

Below is the correct working code for this AndroidManifest.xml register for the recipient

<receiver android:name=".SmsFirst" android:exported="false">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
                </intent-filter>
</receiver>

public class SmsFirst extends BroadcastReceiver {

    private static final Object SMS_RECEIVED    = "android.provider.Telephony.SMS_RECEIVED";
    private static final String TAG          = "SMSBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub

        Log.i(TAG, "Intent recieved: " + intent.getAction());

        if (intent.getAction().equals(SMS_RECEIVED)) {
            abortBroadcast();
                   }
+6
source

I have done it.

Use abortBroadcast (); in the receiver.

+3
source

Source: https://habr.com/ru/post/1766209/