這是給出了服務的啓動通知如何隱藏自來水後,通知在Android應用程序
NotificationCompat.Builder mbuild = new NotificationCompat.Builder(getApplicationContext());
Intent in = new Intent(getApplicationContext(), MainActivity.class);
PendingIntent resultIN = PendingIntent.getActivity(getApplicationContext(),code,in,NOTIFICATION_COUNT); mbuild.setSmallIcon(R.drawable.images1);
mbuild.setContentText(NOTIFICATION_COUNT +" New Message");
mbuild.setContentIntent(resultIN); //mbuild.addAction(R.drawable.notifications,NOTIFICATION_COUNT +"New Messages",resultIN);
NotificationManager nmagr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nmagr.notify(1, mbuild.build());
everyting工作正確..the代碼打開目標活動,但該通知仍然在那裏停留在代碼通知欄。 我曾嘗試使用mbuil.setautocancel(true);但它什麼都不做
'mbuild.setAutoCancel(真)' –
檢查:http://stackoverflow.com/questions/11883534/how-to-dismiss-android-notification-after-action-has-been-clicked – Lokesh