第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

該應用程序只能管理一個推送通知

該應用程序只能管理一個推送通知

侃侃爾雅 2021-08-25 17:43:33
我試圖管理一組推送通知。1.我的第一個問題是只有最后設置的通知才能接收我的智能手機。我相信它沒有創(chuàng)建新實例,但它覆蓋了唯一的實例。我該如何解決?2.我的第二個問題是我想要從應用程序中刪除一個確定通知的時間表。這是我在MovieAdapter.java 中的代碼(主要方法是getNotification、scheduleNotification和deleteNotification):通知發(fā)布者.javapackage com.example.msnma.movienotifier.notify;import android.app.Notification;import android.app.NotificationManager;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;public class NotificationPublisher extends BroadcastReceiver{    public static String NOTIFICATION_ID = "notification-id";    public static String NOTIFICATION = "notification";    public void onReceive(Context context, Intent intent) {        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);        Notification notification = intent.getParcelableExtra(NOTIFICATION);        int id = intent.getIntExtra(NOTIFICATION_ID, 0);        notificationManager.notify(id, notification);    }}
查看完整描述

1 回答

?
慕勒3428872

TA貢獻1848條經(jīng)驗 獲得超6個贊

改變這一行

 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT); //Here 0 is the intent requestcode.

確保意圖請求代碼是唯一的以區(qū)分意圖。


查看完整回答
反對 回復 2021-08-25
  • 1 回答
  • 0 關(guān)注
  • 161 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號