是否有可能知道我的位置,GPS或GLONASS来的? [英] Is it possible to know my location came from gps or glonass?

查看:161
本文介绍了是否有可能知道我的位置,GPS或GLONASS来的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设该设备同时支持GPS和GLONASS(支持在硬件级别)。

现在,当我在android.location API得到的位置,才有可能知道在哪里的位置的?

附带的硬件

 的LocationManager的LocationManager =(的LocationManager)getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,新LocationListener的());类LocationListener的实施LocationListener的(){
    @覆盖
    公共无效onLocationChanged(地点){
        GPSStatus状态= locationManager.getGpsStatus();
        //从状态检查卫星的PRN
        //但如何可以理所当然地认为这里获得的`status`目的是当它被用于计算位置完全相同的?
    }
}

如果我们使用 GPSStatus.Listener 是这样的:

 类LocationListener的实施LocationListener的,GPSStatus.Listener(){
    私人GPSStatus状态;
    @覆盖
    公共无效onLocationChanged(地点){
        如果(状态!= NULL){
            //状态应该是GPSStatus之前得到这个位置
            //从状态检查卫星的PRN
            //如何可以理所当然地认为前`通过Android系统onLocationChanged`了`onGpsStatusChanged`会叫什么名字?
        }    }
   公共无效onGpsStatusChanged(INT事件){
        状态= locationManager.getGpsStatus(NULL);
    }
}


解决方案

位置出身的硬件是手机中的GPS / GLONASS芯片。该芯片由环绕地球的卫星接收信号。

GPS和GLONASS卫星组合使用上支持该设备。要确定是否GLONASS卫星被用来确定位置,你可以注册一个 GpsStatusListener 或致电 LocationManager.getGpsStatus()。呼叫 getSatellites() GpsStatus 对象,并调用 getPrn()返回列表中的每个 GpsSatellite 对象。如果该值是65和88和 usedInFix()方法的返回值之间的真正的最后一个位置是使用GLONASS计算卫星。

请参阅http://developer.sonymobile.com/knowledge-base/technologies/glonass/

Suppose the device support both gps and glonass(support at the hardware level).

Now when I get location by the android.location API, is it possible to know the hardware where the location came from?


LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListener());

class LocationListener implement LocationListener(){
    @Override
    public void onLocationChanged(Location location) {
        GPSStatus status=locationManager.getGpsStatus();
        //check the PRN of the satellites from the status
        //but how can be granted that the `status` object obtained here is exactly the same when it was used to calculate the location?
    }
}

If we use the GPSStatus.Listener like this:

class LocationListener implement LocationListener,GPSStatus.Listener(){
    private GPSStatus status;
    @Override
    public void onLocationChanged(Location location) {
        if(status!=null){
            //status should be the GPSStatus before get this location
            //check the PRN of the satellites from the status
            //How it can be granted that the `onGpsStatusChanged` will be called before the `onLocationChanged` by the Android System?
        }

    }
   public void onGpsStatusChanged(int event) {
        status = locationManager.getGpsStatus(null);    
    }
}

解决方案

The hardware the location came from is the GPS/GLONASS chip in your phone. The chip receives signals from satellites orbiting the earth.

GPS and GLONASS satellites are used in combination on devices that support this. To determine if GLONASS satellites were used to determine the location, you can either register a GpsStatusListener or call LocationManager.getGpsStatus(). Call getSatellites() on the GpsStatus object and call getPrn() on each GpsSatellite object in the returned list. If the value is between 65 and 88 and the usedInFix() method returns true the last position was calculated using a GLONASS satellite.

See http://developer.sonymobile.com/knowledge-base/technologies/glonass/

这篇关于是否有可能知道我的位置,GPS或GLONASS来的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆