Question

I'm developing an application , and want to check every SMS messages content for a specific text , and do some actions the delete the SMS , and not let user notify if the message contained that text , else I will recreate a notification and notify user , I am using BroadcatReceiver , and I can read the message the moment it arrives , but cant stop the notification in notification bar , I've searched but couldn't get satisfactory answer, any help would be appreciated

that is my bradcasrReceiver class

package com.example.helloworld;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver {

   @Override
   public void onReceive(Context context, Intent intent) {
      Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show();
   }

}
Was it helpful?

Solution

I strongly recommend it to watch this :

Can we delete an SMS in Android before it reaches the inbox?

but becareful about android:priority ,

As of Android 1.6, incoming SMS message broadcasts (android.provider.Telephony.SMS_RECEIVED) are delivered as an "ordered broadcast" — meaning that you can tell the system which components should receive the broadcast first.

If you define an android:priority attribute on your SMS-listening , you will then receive the notification before the native SMS application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top