Skip to content

Both ACCESS_WIFI_STATE & ACCESS_FINE_LOCATION permissions are required (Android) #294

@tiendatnguyen678

Description

@tiendatnguyen678

When i use getCurrentPlace() the message error return:

Error: Both ACCESS_WIFI_STATE & ACCESS_FINE_LOCATION permissions are required
at Object.fn [as getCurrentPlace] (NativeModules.js:99)
at RNGooglePlaces.getCurrentPlace (index.js:50)
at Object.onPress (DetailInstallScreen.js:2071)
at Object.touchableHandlePress (TouchableOpacity.js:264)
at Object._performSideEffectsForTransition (Touchable.js:880)
at Object._receiveSignal (Touchable.js:779)
at Object.touchableHandleResponderRelease (Touchable.js:490)
at Object.invokeGuardedCallbackImpl (ReactNativeRenderer-dev.js:307)
at invokeGuardedCallback (ReactNativeRenderer-dev.js:531)
at invokeGuardedCallbackAndCatchFirstError (ReactNativeRenderer-dev.js:555)

AndroidManifest.xml file:

<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Required -->
<uses-permission android:name="android.permission.CAMERA" />

<!-- Include this only if you are planning to use the camera roll -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Include this only if you are planning to use the microphone for video recording -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

<application
  android:largeHeap="true"
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme"
  android:requestLegacyExternalStorage="true"
  >
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize"
    android:screenOrientation="portrait">
    <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" />
  <meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="my_api_key"/>
  <uses-library android:name="org.apache.http.legacy" android:required="false"/>
</application>

But when i check PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION) & PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_WIFI_STATE) it's result is true.

This is my function:

RNGooglePlaces.getCurrentPlace()
.then((results) => {
console.log(results)
this.setState({
location: {
latitude: results[0].location.latitude,
longitude: results[0].location.longitude
}
})
}).catch((error) => console.log(error))

On iOS is ok. Thanks for help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions