如何在android中添加GPS信号强度栏?

发布于 2024-12-01 19:36:42 字数 102 浏览 0 评论 0原文

我正在尝试创建一个 GPS 信号强度条来衡量位置的准确性(标准可能是 3 个最低和 10 个最高)。我希望看到它就像我们手机上的信号条一样,告诉我们我们的服务如何。有谁知道如何创建这个酒吧?

I am trying to create a GPS signal strength bar that will gauge the accuracy of the positions (the criteria would probably be 3 lowest and 10 highest ). I would like to see it like the signal bars we have on the phones telling us how our service is. Does anyone know how to create this bar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

伴随着你 2024-12-08 19:36:42

该问题由两个子问题组成:

1)如何获取GPS信号强度?

查看

2)如何显示强度条?

我假设您想将其显示在上部通知栏中。据我所知,您不会将该栏放入该栏的正确位置,因为它是系统保留的。但是,您可以简单地创建一个简单的通知来显示图标在状态栏的左侧。当强度发生变化时,只需更新通知的图标即可完成。

This problem consists of two sub-problems:

1) How to obtain the GPS signal strength?

Looking at the Location object that is provided when your application has registered itself as a LocationListener, the object provides a getAccuracy() method which returns how certain the location is.

2) How to show a strength bar?

I assume that you want to show it in the upper notification bar. As far as I know, you won't get the bar into the right part of the bar as it's system-reserved. However, you can simply create a simple Notification which shows the icon in the left part of your status bar. When the strength changes, just update the Icon of your notification and you're done.

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