Unable to get Android satellite count

It seems I can’t count the number of satellites when using the geo fix command, although adb.

Location Fix:

geo fix <longitude> <latitude> [<altitude> [<satellites>]] allows you to send a simple GPS fix to the emulated system The parameters are: <longitude> longitude, in decimal degrees <latitude> latitude, in decimal degrees <altitude> optional altitude in meters <satellites> number of satellites being tracked (1-12) 

I use the following command to set the geolocation to run OnLocationChanged to execute:

 geo fix -106.1221 52.1311 514 5 

In OnlocationChanged:

 Location newestloc = loc; Bundle sats = newestloc.getExtras(); int satcount = 0; satcount = sats.getInt("satellites"); 

However, whenever I call satcount, I always get 0. Does the number of satellites passing through the geo patch not count?

Are there any other ways to get the number of satellites that are currently displayed by the GPS phone?

Edit: I also tried the following code:

 GpsStatus gpsstat = mlocManager.getGpsStatus(null); Iterable sats = gpsstat.getSatellites(); Iterator satI = sats.iterator(); int count = 0; while(satI.hasNext()){ GpsSatellite gpssatellite = (GpsSatellite) satI.next(); if (gpssatellite.usedInFix()){ count++; } } 

This should minimally return 1 every time I get a fix, but it never changes from 0.

+6
java android gps
source share
3 answers

Closing the question, as I could not find the information, and the application seems to be functioning normally, without the number of satellites, as it was just an extra field that we were looking at.

-one
source share

http://developer.android.com/reference/android/location/GpsStatus.html

try getSatellites ()

What type of phone are you testing? Have you tried checking which lbstest mode returns? Maybe the phone itself does not collect satellites.

+1
source share

There seems to be a bug in the Android processing of the geo fix command in some versions. You can try geo fix -106.1221 52.1311 514 5 12 , where the number 5 is ignored on some implementations, and 12 as the number of satellites. Thus, the actual syntax for erroneous systems will be

 geo fix <longitude> <latitude> [<altitude> [<dummy> <satellites>]] 
+1
source share

All Articles