开发者

How long will a non-clearing notification stay?

开发者 https://www.devze.com 2023-04-07 10:17 出处:网络
If my app fires a notification and marks it as non-clearing (i.e. tapping it does not remove it), what will result in the notification being removed?

If my app fires a notification and marks it as non-clearing (i.e. tapping it does not remove it), what will result in the notification being removed?

Would I be right in assuming that if the app is shut down by the memory manager that this will cause the notification will be removed? Or will the notification persist even if the app i开发者_StackOverflow社区s recycled?

My app needs to show a persistent notification, and I need to understand whether I can set it up in the app, or if I need to build a service to manage it.


When you start a notification with the FLAG_NO_CLEAR it will persist until you cancel it in the NotificationManager with a call to NotificationManager.cancel(int notificiationId)

I'm not sure what would happen to the notification if your app were uninstalled, although I suspect it would be cleared then too. That said it should be really easy to test. Create an activity that creates a notification. Then close it, kill it, uninstall it, etc... and see what happens.

0

精彩评论

暂无评论...
验证码 换一张
取 消