【问题标题】:React Native geolcation number of satterlitesReact Native 地理定位卫星数量
【发布时间】:2019-12-10 03:06:03
【问题描述】:

任何人都知道如何在本机反应中获得卫星数量。目前,我正在使用 https://github.com/react-native-community/react-native-geolocation 但它没有给出卫星的数量

【问题讨论】:

    标签: android react-native mobile geolocation location


    【解决方案1】:

    对于 Android,您可以通过本机模块获取 inf。在android原生中,可以使用localManager获取卫星数量。

    privateLocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 
    
    //it uses GPS, so you have to check if GPS is working
    
    //add the listener
    manager.registerGnssStatusCallback(gpsStatusListener);
    
    private GpsStatus.Callback gpsStatusListener = new GpsStatus.Callback() {
        @Override
        public void onSatelliteStatusChanged(GnssStatus status) {
            int count = status.getSatelliteCount()
        }
    };
    
    

    react-native 原生模块的写法可以看官方文档; 对于ios,它无法获取信息。

    你也可以使用这个react-native-location-satellites来获取。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-20
      • 2016-01-25
      • 2021-12-29
      • 2016-10-26
      • 1970-01-01
      • 1970-01-01
      • 2018-12-10
      • 1970-01-01
      相关资源
      最近更新 更多