简体   繁体   English

在Android中可以连续显示状态栏通知

[英]In Android is it possible to continuously show status bar notification

In my app, I have to continuously show status bar notification after some event is triggered. 在我的应用中,我必须在触发某些事件后连续显示状态栏通知。 The status bar must glow in red rather than in default background. 状态栏必须以红色发光,而不是默认背景。 During that period,I am responsible for recording sound ie it is just like recorder but the instead of running in Activity, it will run on Service and the user is notified by blinking status bar in red. 在此期间,我负责录制声音,即它就像录音机一样,但不是在Activity中运行,而是在Service上运行,并且状态栏呈红色闪烁通知用户。 The user at any time can go the status bar and stop the recording.And the recording can carry on even when lockscreen is on. 用户可以随时进入状态栏并停止录制。即使锁定屏幕打开,录制也可以继续进行。 So is it possible to achieve this in Android and if possible could you give us some logic for this implementation. 因此有可能在Android中实现此目标,如果可能的话,您可以为我们提供一些实现此逻辑的方法。

Consider using a foreground service , which lets you post an ongoing notification. 考虑使用前台服务 ,它可以让您发布正在进行的通知。 There's no API for changing the color of the entire status bar. 没有用于更改整个状态栏颜色的API。 You can certainly color your icons, and on JellyBean and later you may be able to change the color of the notification itself using RemoteViews -- that's talked about in this link . 您当然可以为图标着色,并且在JellyBean及更高版本上,您可以使用RemoteViews更改通知本身的颜色- 在此链接中已进行了讨论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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