简体   繁体   English

状态栏通知

[英]Status bar notification

I want to implement a status bar notification and have some sound, and flashing alert to the user. 我想实现一个状态栏通知,并向用户发出一些声音和闪烁的警报。

The sound plays very fine, but the problem is it stops just the user click on the status bar. 声音播放的非常好,但是问题是它仅在用户单击状态栏时停止。

I want to continue playing the sound until the user does not want to stop it by clicking any button on it. 我要继续播放声音,直到用户不想通过单击它上的任何按钮来停止它为止。

How can I do this? 我怎样才能做到这一点?

您需要一次又一次地infinite loo播放声音,并maintain a bool值来开始和停止声音,就像当用户按下将其设为true并再次单击使其变为false并退出循环时一样。您可以使用sharedPreferences进行存储布尔值。

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

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