user3866012
user3866012

Reputation: 1

How do I remove pushbots notifications while user is in the app?

I am using pushbots with an android app. I have a custom broadcast receiver that handles notifications in the app. However, when I exit the app, all of the notifications are still there. How can I clear these notifications? I have tried the solutions on these questions: How to clear a notification in Android

How to remove notification from notification bar programmatically in android?

but Im still not having any luck. Any suggestions?

private BroadcastReceiver receiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("CHAT", "RECIEVED");
        Bundle notification = intent.getExtras();
        String type = notification.getString("type");

       //do some stuff here

        NotificationManager nMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        //nMgr.cancel();
        nMgr.cancelAll();
        Log.d("CHAT", "CANCEL");
    }

};

Upvotes: 0

Views: 147

Answers (0)

Related Questions