[英]Display notification every time I minimize app
Context:语境:
My app has 5 activities:我的应用有 5 个活动:
Currently I create notification in onCreate method of the service, which display recent activity after touching, based on目前,我在服务的onCreate方法中创建通知,该通知在触摸后显示最近的活动,基于
Problem问题
setOngoing method Notification.Builder is annoying - is always here, independent if my app is in foreground or not. setOngoing方法Notification.Builder很烦人 - 总是在这里,无论我的应用程序是否在前台,都是独立的。 So I change to the setAutoCancel method, but works only for first use.
所以我更改为setAutoCancel方法,但仅适用于第一次使用。 Example:
例子:
I run my app - splashscreen activity (notification is shown) -> main activity -> select Activity 1 - minimize.我运行我的应用程序 - 启动屏幕活动(显示通知) -> 主要活动 -> select 活动 1 - 最小化。 Now click notification - brings Activity 1 (OK), but notification is dismissed and never shown.
现在单击通知 - 带来活动 1(确定),但通知被解除且从未显示。
Question问题
How to display notification, every time I minimize app?
每次最小化应用程序时如何显示通知?
Simple override onPause and put the notification logic there.简单覆盖onPause并将通知逻辑放在那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.