How long will a non-clearing notification stay?
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.
精彩评论