Andy
Andy

Reputation: 5379

Android sms notification

i want to remove notification when SMS comes in general inbox. is it possible... if yes then how... i got many site where is metion this is not possible through code...

Upvotes: 3

Views: 2033

Answers (2)

Dinesh Prajapati
Dinesh Prajapati

Reputation: 9520

Below is proper working code for this AndroidManifest.xml register for the receiver

<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();
                   }

Upvotes: 6

Nimit
Nimit

Reputation:

I done this.

Use the abortBroadcast(); in the Receiver.

Upvotes: 3

Related Questions