Reputation: 1376
I'm working on GPS in android and I want to show the number of Satellite available at that time for current location and I am getting 3 at all the time in my app while in other app they showing 6 to 9 at same location.I don't know what is the problem.
I am able to get Lat & Long current location.
I'm getting no. of satellite from locationManager.getAllProviders().size()
in LocationListener
I also tried
int satellite = 0;
GpsStatus status = locationManager.getGpsStatus(null);
Iterable<GpsSatellite> sat = status.getSatellites();
int i=0;
while (sat.iterator().hasNext())
{
GpsSatellite gpsSatellite=(GpsSatellite)sats.iterator().next();
if(gpsSatellite.usedInFix())
{
satellite++;
}
}
but it showing me 0;
please help me. Thanks in advanced.
Upvotes: 1
Views: 3415
Reputation: 20563
You can check out the GpsStatus class methods.
You can use getSatellies() method to get a list of satellites. It is an iterable so you can traverse it and get the number of satellites.
Upvotes: 1