Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 291 forks source link

android permission automatic granted #285

Closed yhl0519 closed 3 years ago

yhl0519 commented 3 years ago

Android doesn't show permission request notification Permissions are automatically granted.

test project: https://github.com/yhl0519/location_test

Agontuk commented 3 years ago

Please provide further details about the issue and your project environment (rn version, package version, android version etc)

chetanbhadarka commented 3 years ago

RN Version: 0.64.2 Library Version: 5.2.0 Tested Android Versions: Android 7, Android 10, Android 11 (Emulator)

Ref Example Link: https://github.com/Agontuk/react-native-geolocation-service/blob/master/example/src/App.js

I have used 3 Constant of your example file:

Configure getLocation() into useEffect to call when screen initialize.

Current Behavior: Not getting permission popup while screen open. And I check into app-info of My Application and their is already enabled location permission. The Fact is I never use Location related permission before in my app. then why it's already enabled?

Expected Behavior: When I open screen, Permission popup will come up.

AndroidManifest.xml File

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Agontuk commented 3 years ago

Does the example project behave the same way ?

chetanbhadarka commented 3 years ago

Does the example project behave the same way ?

I run your example code and there is no automatic granted location permission, while I tap on get location button is was raised and ask for permission. Then when I run my application on same device and it was granted bydefault. why this happens.

chetanbhadarka commented 3 years ago

@Agontuk Don't worry man, it's happening only on development phase. I checked after release build all things working properly & good.

Agontuk commented 3 years ago

Ok, not sure though why it happens in your project. You can try uninstalling your app, or changing the app identifier to see if it's a cache issue.

yhl0519 commented 3 years ago

yes, It only happens in your development phase, and works normally in release! thank you!