简体   繁体   中英

Possible to set indicator icons on Android phones?

我想知道是否可以通过编程方式设置手机的指示器图标,例如GPS或正在进行的上传/下载等。

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

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:

  1. 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.

  2. 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.

  3. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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