android 通知折叠点击,如何折叠Android通知?
我每半小時(shí)向我的Android應(yīng)用發(fā)送一次C2DM更新,這會(huì)創(chuàng)建一個(gè)通知.問(wèn)題是,當(dāng)我早上醒來(lái)時(shí),我在狀態(tài)欄中排隊(duì)了15個(gè)通知.
我如何只保留最新通知,覆蓋以前的通知?
我試著查看C2DM文檔(http://code.google.com/android/c2dm/),其中提到了一個(gè)名為collapse_key的參數(shù),但是我找不到如何使用它的解釋,也不確定解決方案是在C2DM方面.
謝謝!
解決方法:
如果要取消在視圖上設(shè)置的任何先前通知,可以嘗試設(shè)置其中一個(gè)標(biāo)志.
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_UPDATE_CURRENT
這樣的事情應(yīng)該取代我相信的舊通知
NotificationManager mManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(this,test.class);
Notification notification = new Notification(R.drawable.icon, "Notify", System.currentTimeMillis());
notification.setLatestEventInfo(this,"App Name","Description of the notification",
PendingIntent.getActivity(this.getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
mManager.notify(0, notification);
標(biāo)簽:android,push-notification,android-c2dm
來(lái)源: https://codeday.me/bug/20191001/1839648.html
總結(jié)
以上是生活随笔為你收集整理的android 通知折叠点击,如何折叠Android通知?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梅捷主板bios怎么U盘启动 梅捷主板如
- 下一篇: u盘启动怎么重启一直u盘启动不起来 重启