如果应用程序终止,保留 Android 通知事件?
在我的应用程序中,当用户执行事件时,我将通知添加到通知栏。无论应用程序位于前台还是后台,点击该通知都会起作用。
我希望即使应用程序终止(由于内存等),通知也能持续存在。并让通知点击重新启动应用程序。
这有可能吗?
我到处寻找但找不到答案。
我已将通知标志设置为Notification.FLAG_NO_CLEAR,因此用户无法清除它,但在应用程序终止后,通知将被删除。
In my app, when a user executes and event, I add a notification to the notification's bar. Tapping that notification works both if the app is in the foreground or if it is backgrounded.
I would like the notification to persist even if the app is terminated (due to memory, etc.). And have the notification tap relaunch the app.
Is that, at all, possible?
I've searched all over and can't find an answer.
I have set my notification flags to Notification.FLAG_NO_CLEAR so the user can't clear it, but upon app termination, the notification gets removed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能希望通知由服务管理。服务可以配置为在终止时自动重新启动。
You probably want the notification to be managed by a service. Services can be configured to restart automatically on termination.