1
我搜索很多次,但我沒能找到我真正需要的, 有計算器上類似this和this ,但我需要實現我的代碼爲api level 8
不。那麼如何在我的代碼中實現它?如何將刪除意圖設置爲我的代碼?
我的代碼是在這裏:
....
mNotification = new Notification(icon, tickerText, when);
//create the content which is shown in the notification pulldown
mContentTitle = mContext.getString(R.string.noti_comes_t_l); //Full title of the notification in the pull down
CharSequence contentText = "click to see notification"; //Text of the notification in the pull down
//you have to set a PendingIntent on a notification to tell the system what you want it to do when the notification is selected
//I don't want to use this here so I'm just creating a blank one
mContentIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, notify.class), 0);
//add the additional content and intent to the notification
mNotification.setLatestEventInfo(mContext, mContentTitle, contentText, mContentIntent);
//make this notification appear in the 'Ongoing events' section
mNotification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL ;
//show the notification
mNotificationManager.notify(NOTIFICATION_ID, mNotification);
....
我如何能實現呢?
感謝的答案,但這裏是刪除意圖適應呢? –
我的意思是我想檢測用戶何時清除我的通知 –
我編輯了代碼以專門添加該行,只需創建另一個PendingIntent並將其放在那裏 –