Reputation: 1
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