-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
import { Platform } from 'react-native';
import AMapGeolocation from '@uiw/react-native-amap-geolocation';
let apiKey = '';
if (Platform.OS === 'ios') {
apiKey = '用于 iOS 的 apiKey';
}
if (Platform.OS === 'android') {
apiKey = '用于 Android 的 apiKey';
}
// 设置 高德地图 apiKey
AMapGeolocation.setApiKey(apiKey);
// iOS 指定所需的精度级别
AMapGeolocation.setDesiredAccuracy(3);
// Android 指定所需的精度级别,可选设置,默认 高精度定位模式
AMapGeolocation.setLocationMode(1);
// 定位是否返回逆地理信息
AMapGeolocation.setLocatingWithReGeocode(true);
async function getCurrentLocation(){
try {
const json = await AMapGeolocation.getCurrentLocation();
console.log('json:', json);
} catch (error) {
console.log('error:', error);
}
}getCurrentLocation的json 老是null,请问要如何配置
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels