gpt4 book ai didi

android - React Native 地理定位卫星数量

转载 作者:行者123 更新时间:2023-11-30 04:55:33 25 4
gpt4 key购买 nike

任何人都知道如何在 React Native 中获取卫星数量。目前,我正在使用 https://github.com/react-native-community/react-native-geolocation但是它没有给出卫星数量

最佳答案

对于Android,你可以通过native module获取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 native module的写法可以看官方文档;对于 ios,它无法获取信息。

你也可以使用这个 react-native-location-satellites得到。

关于android - React Native 地理定位卫星数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59259611/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com