I can"t get the geographic location information using react-native-amap-geolocation. Please give me some advice on
AndroidManifest.xml configuration
< manifest xmlns:android= "http://schemas.android.com/apk/res/android"
package="com.gyf.dairy">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!---->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<!--GPS-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<!---->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<!--wifiwifi-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<!--wifiwifi-->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<!---->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<!---->
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<!---->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<!--A-GPS-->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<!---->
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
android:name=".wxapi.WXPayEntryActivity"
android:label="@string/app_name"
android:exported="true"
/>
<activity
android:name=".wxapi.WXEntryActivity"
android:label="@string/app_name"
android:exported="true"
/>
<!--key-->
<meta-data android:name="com.amap.api.v2.apikey" android:value="........">
</meta-data>
<!-- 2.0 -->
<service android:name="com.amap.api.location.APSService" >
</service>
</application>
< / manifest >
the code called
const granted = await PermissionsAndroid.request (
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{
"title": "",
"message": " "
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("granted",granted)
await Geolocation.init({
ios: "9bd6c82e77583020a73ef1af59d0c759",
android: "5e28fe1c8d1ccd41e280661ad7276ffe"
})
Geolocation.setOptions({
interval: 60,
distanceFilter: 20,
needDetail:true,
})
Geolocation.addLocationListener(location =>{
Alert.alert("city",location)
})
Geolocation.start()
}