android 通知折叠点击,如何折叠Android通知?
我每半小時向我的Android應用發送一次C2DM更新,這會創建一個通知.問題是,當我早上醒來時,我在狀態欄中排隊了15個通知.
我如何只保留最新通知,覆蓋以前的通知?
我試著查看C2DM文檔(http://code.google.com/android/c2dm/),其中提到了一個名為collapse_key的參數,但是我找不到如何使用它的解釋,也不確定解決方案是在C2DM方面.
謝謝!
解決方法:
如果要取消在視圖上設置的任何先前通知,可以嘗試設置其中一個標志.
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_UPDATE_CURRENT
這樣的事情應該取代我相信的舊通知
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);
標簽:android,push-notification,android-c2dm
來源: https://codeday.me/bug/20191001/1839648.html
總結
以上是生活随笔為你收集整理的android 通知折叠点击,如何折叠Android通知?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梅捷主板bios怎么U盘启动 梅捷主板如
- 下一篇: u盘启动怎么重启一直u盘启动不起来 重启