1
A
回答
0
我也有類似的問題,我試過各種方法。我終於能夠使用共享首選項解決它。雖然這不是一個相對普遍的做法,但它有幫助,因爲您可以跟蹤發送的每個通知。這裏是一個代碼片段:
SharedPreferences prefs = getSharedPreferences(Activity.class.getSimpleName(), Context.MODE_PRIVATE);
int notificationNumber = prefs.getInt("notificationNumber", 0);
notificationManager.notify(notificationNumber, notification);
SharedPreferences.Editor editor = prefs.edit();
notificationNumber++;
editor.putInt("notificationNumber", notificationNumber);
editor.commit();
我希望這會有所幫助..快速編碼!!!
相關問題
- 1. Android項目相互重疊
- 2. 表相互重疊
- 3. android按鈕與按鈕互相重疊
- 4. ViewControllers在Main.Storyboard互相重疊
- 5. bootstrap容器相互重疊
- 6. JavaScript字相互重疊
- 7. Div互相重疊 - HTML
- 8. 鏈接互相重疊
- 9. 鏈接互相重疊
- 10. 鈦:聲音互相重疊
- 11. 按鈕相互重疊
- 12. 查看相互重疊
- 13. Unity註冊互相重疊
- 14. 主題相互重疊?
- 15. 兩個相對的div互相重疊
- 16. 相互通知模式
- 17. sas gchart hbar酒吧互相重疊
- 18. 導航圖像互相重疊
- 19. div元素互相重疊-css
- 20. 右側邊框互相重疊
- 21. 旋轉元素互相重疊
- 22. 在relativeLayout中相互重疊的元素
- 23. 多種背景顏色相互重疊
- 24. 如何處理互相重疊的iBeacon
- 25. 砌體:互相重疊的圖像
- 26. CSS固定位置互相重疊
- 27. 響應CSS的div互相重疊
- 28. HTML中的Div標籤互相重疊
- 29. 如何摺疊Android通知?
- 30. Android交互式通知
可能兩個通知ID都會一樣嘗試更改通知ID來解決此問題。 –
每次都在發生嗎?如果他們不斷變換職位,您可以設置通知的優先級。設置其中一個通知的優先級要高於其他 – Ezio
notificationManager.notify(「更改此ID」,builder.build());嘗試更改ID。 –