任何人都知道如何获得本机反应中的卫星数量。目前,我正在使用 https://github.com/react-native-community/react-native-geolocation 但是它并没有提供很多卫星
答案 0 :(得分:0)
对于Android,您可以通过本机模块获取inf。在android native中,您可以使用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来获取。