中的通知ID我正在製作一個基於通知的應用程序,在該通知中我實現了通知代碼,但是代碼中我想提供有關通知ID的信息,什麼是任何人可以解釋我的通知。什麼是android
代碼: -
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setContentTitle("This is a notification");
mBuilder.setSmallIcon(R.drawable.app_me);
mBuilder.setContentText("You have successfully created notification");
Intent resultIntent = new Intent(this,ResultActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(ResultActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPending = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPending);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// notificationID allows you to update the notification later on.
notificationManager.notify(notificationID, mBuilder.build());
進行更新,以通知ID問題,它和我的代碼運行成功完全 – Satish
但是當我點擊通知將被重定向到結果屏幕,但通知仍會出現在狀態欄 – Satish
您的代碼將運行。如果您需要更新/刪除創建的通知手段。您需要使用NotificationID。 –