Closed baryshok closed 6 years ago
The solution I see is to show OS preferences not only if app's AuthorizationStatusNotDetermined, but also if Location Services are disabled. I'm not an iOS dev, but I've found that detecting if Location Services is enabled could be done like this: CLLocationManager.locationServicesEnabled()
https://stackoverflow.com/questions/34861941/check-if-location-services-are-enabled
Also, currently isLocationEnabled
method checks if app has Location permissions. But the method's name is really misleading. Yes, there is a description of what it really does in README, but still that's not good. I believe it should check if Location Services are enabled.
Frankly speaking, when I chose your package I didn't read README carefully enough, and thought that I found what I was looking for -- a way to detect if Location Services are enabled. I know that it would be a breaking change, but I believe it would be a right thing to make two separate methods: isLocationEnabled
and getAuthorizationStatus
. Just bump major version of the package and I think no one who use the package will be affected by these changes.
Thanks!
Hi @baryshok , once again thank you for your feedback.
I think you've got a point about isLocationEnabled
method being misleading on iOS
platform.
I'll look into this issue and consider your request for the next major version.
Hi @baryshok ,
I just released a new version (1.4.0
), with the following changes:
isLocationEnabled
now actually checks for Location Services
status (instead of permissions)ConnectivityManager.enableLocation()
now opens location services
page in case they are disabled, in case the permissions have been asked before the App settings
page is shown, if permission have yet to be asked to the user the promise will be rejected.Unfortunately I discovered through various tests and searches that on iOS 11
an app cannot open a specific Settings
page, so calling enableLocation
when the Location services
are not enabled will only open the Settings
app on the main page.
@panz3r Thank you so much! Yes, I've also searched for iOS 11 issue fix, but haven't find it so far. I'll write back if eventually find it.
Hi @baryshok , Thank for your support!
I opened a new issue (#4) to keep track of the iOS 11
issue and I'm going to close this one.
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 9.2.1 Yarn: 1.3.2 npm: 5.5.1 Watchman: 4.7.0 Xcode: Xcode 8.3.3 Build version 8E3004b Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.3 => 0.50.3
Target Platforms: Android: 5.0 (API 21) iOS: 8.0
Steps to Reproduce
ConnectivityManager.enableLocation()
in the app.Expected Behavior
OS preferences should be opened where we can enable Location Services.
Actual Behavior
App's preferences are opened, but there's no use for it, since app's Location Services permissions are not editable when Location Services are globally disabled.