开发者

How to add GPS signal strength bar in android?

开发者 https://www.devze.com 2023-03-31 11:06 出处:网络
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

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 crea开发者_运维技巧te this bar?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消