安卓手机可以设置指示灯图标吗?
我想知道是否有一种方法可以以编程方式设置手机的指示器图标,例如 GPS 或正在进行的上传/下载等。
I was wondering if there is a way to programatically set the phone's indicator icons, like GPS or upload/download in progress,etc.. ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须使用通知。初始化Notification类时设置图标。您可以在此处获取更多详细信息
http://developer.android.com/guide /topics/ui/notifiers/notifications.html
You have to use a Notification. Set the icon when initializing Notification class. You can get more details here
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
是的,通知就是您正在寻找的。如果您要通知用户刚刚发生的事情(例如,一条消息到达),您应该使用普通的通知 1.但是,如果您想通知用户服务正在运行,那么您应该从服务中调用 startForeground() 2,并在完成操作后 stopForeground() 。
需要注意的一些要点:
仅对用户关心的事情使用通知。这看起来似乎很明显,但您会发现数量惊人的应用程序会通知用户一些他们并不真正关心(或可以做任何事情)的后台维护过程。
让用户自定义什么类型的事情应该触发通知。如果手机不断发出蜂鸣声和振动,用户可能会非常烦恼。
每个通知都应该有一个适当的意图,允许用户对该特定通知采取操作,并且该意图应该是对该特定事件最有意义的意图 - 例如,当用户点击“新”时消息”通知时,他希望被带到一个可以阅读该消息的屏幕。在这种情况下,将用户发送到应用程序的主屏幕的用处将会大大降低。
Yes, Notifications is what you are looking for. If you are notifying the user about something that just happened (for instance, a message arrived), you should use a plain Notification 1. However, if you want to notify the user that a service is running, then you should call startForeground() from your Service 2, and stopForeground() when you are done with the operation.
Some points to keep an eye out for:
Only use notification for things the user cares about. This may seem pretty obvious, but you'll find a surprising number of applications that notify the user of some background maintenance process that they don't really care (or can do anything) about.
Let the user customize what sort of things should trigger a notification. It might be very annoying for the user if the phone is constantly beeping and vibrating.
Every notification should have an appropriate Intent that allows the user to take action on that particular notification, and that Intent should be the one that makes the most sense for that particular event -- for example, when the user taps a "new message" notification, he expects to be let to a screen where he can read the message. Sending the user to your application's home screen in that case will be much less useful.