I'm trying to have three bars that act as a notification to how strong your gps signal is. Three bars for good开发者_如何学JAVA connection, one bar for weak etc. How do I check the gps signal strength and show the corresponding bars? Thanks
I think there is no such thing as strength, but I think you mean accuracy, the bars you see are "blinking"(on the notification bar on the phone) while device is retrieving the coordinates and other data related to your position.
You can measure the accuracy with using getAccuracy()
method, but the accuracy depends on how much satellites cover your area and other factors (Google around), you can collect this information with getSatellites()
.
For your purpose you can measure the accuracy and display custom number of bars for your custom GPS indicator.
Satellites send raw data package known as NMEA
which contains wide range of information (strings). You can read more here:
http://aprs.gids.nl/nmea/
精彩评论