任何人都知道我們如何從應用程序中刪除通過使用待定意圖調用的應用程序的通知。如何在android中以編程方式從通知欄中刪除通知?
我曾經使用下面的方法取消通知。
AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(Display.this, TwoAlarmService.class);
PendingIntent pi = PendingIntent.getBroadcast(Display.this, AlarmNumber, intent, PendingIntent.FLAG_CANCEL_CURRENT);
am.cancel(pi);
但是問題是已經發出的通知不會從通知欄中刪除。
在此先感謝...
您好,我不知道是否有可能programaticaly移除通知之前,但是你可以重寫新的最老的通知確實如此。如果它充分滿足您的要求,那麼我可以在這裏發佈代碼。 PLZ回覆 –
不,實際上我有兩個不同的通知,我已經取消通知。 –