简体   繁体   中英

How long will a non-clearing notification stay?

If my app fires a notification and marks it as non-clearing (ie 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 is 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM