安卓手机可以设置指示灯图标吗?

发布于 2024-12-25 11:58:02 字数 56 浏览 3 评论 0原文

我想知道是否有一种方法可以以编程方式设置手机的指示器图标,例如 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

庆幸我还是我 2025-01-01 11:58:02

您必须使用通知。初始化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

乖乖哒 2025-01-01 11:58:02

是的,通知就是您正在寻找的。如果您要通知用户刚刚发生的事情(例如,一条消息到达),您应该使用普通的通知 1.但是,如果您想通知用户服务正在运行,那么您应该从服务中调用 startForeground() 2,并在完成操作后 stopForeground() 。

需要注意的一些要点:

  1. 仅对用户关心的事情使用通知。这看起来似乎很明显,但您会发现数量惊人的应用程序会通知用户一些他们并不真正关心(或可以做任何事情)的后台维护过程。

  2. 让用户自定义什么类型的事情应该触发通知。如果手机不断发出蜂鸣声和振动,用户可能会非常烦恼。

  3. 每个通知都应该有一个适当的意图,允许用户对该特定通知采取操作,并且该意图应该是对该特定事件最有意义的意图 - 例如,当用户点击“新”时消息”通知时,他希望被带到一个可以阅读该消息的屏幕。在这种情况下,将用户发送到应用程序的主屏幕的用处将会大大降低。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文