tnrn-amap-location
v1.0.4
Published
A AMap location Library for React Native apps.
Downloads
5
Maintainers
Readme
tnrn-amap-location
使用
yarn add tnrn-amap-location
iOS 需要这样设置:
Build Setting
->Framework Search Paths
中添加$(SRCROOT)/../node_modules/tnrn-amap-location/ios/Framework
Build Phases
->Link Binary WithLibraries
中添加ExternalAccessory.framework
获取 Key:
import { PermissionsAndroid } from "react-native"
import { Geolocation } from "tnrn-amap-location"
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
await Geolocation.init({
ios: "9bd6c82e77583020a73ef1af59d0c759",
android: "043b24fe18785f33c491705ffe5b6935"
})
Geolocation.setOptions({
interval: 8000,
distanceFilter: 20
})
Geolocation.addLocationListener(location => console.log(location))
Geolocation.start()
}
最后:
由于 react-native-amap-geolocation 有些在使用上面的问题,因此 fork 了这份代码