2015-02-05 99 views

回答

2

您需要从您的nmea字符串中读取GGA字段。它为您提供正在追踪的卫星数量

GGA - 必不可少的修复数据,提供3D位置和精确度数据,

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 

其中:

 GGA   Global Positioning System Fix Data 
    123519  Fix taken at 12:35:19 UTC 
    4807.038,N Latitude 48 deg 07.038' N 
    01131.000,E Longitude 11 deg 31.000' E 
    1   Fix quality: 0 = invalid 
           1 = GPS fix (SPS) 
           2 = DGPS fix 
           3 = PPS fix 
        4 = Real Time Kinematic 
        5 = Float RTK 
           6 = estimated (dead reckoning) (2.3 feature) 
        7 = Manual input mode 
        8 = Simulation mode 
    08   Number of satellites being tracked <-- this is what you want 
    0.9   Horizontal dilution of position 
    545.4,M  Altitude, Meters, above mean sea level 
    46.9,M  Height of geoid (mean sea level) above WGS84 
         ellipsoid 
    (empty field) time in seconds since last DGPS update 
    (empty field) DGPS station ID number 
    *47   the checksum data, always begins with * 

那么你可以使用String::split()方法来读取被跟踪的卫星数量。

+0

我认为Android的GPS并不使用所有GGA的卫星数量......我认为这个数字是手机看到它们的所有卫星的数量(也许并不是全部使用它们)。我怎么能给出电话使用它们来获得我的坐标的卫星数量? – jion 2015-02-10 11:12:58

+0

@jion,你可能需要阅读这个,http://aprs.gids.nl/nmea,这就是它说的“7 =正在使用的卫星的数量[不是那些在视图中]” – 2015-02-10 15:38:50

+0

我在其他文档中读到GPGGA的第七位是GPS看到的所有卫星...它返回10或11 ...我不认为这是使用中的卫星数量! :| – jion 2015-02-10 20:59:04