Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requestLocationAuthorization successcallback triggers too early #185

Closed
HuaHub opened this issue Mar 25, 2017 · 9 comments
Closed

requestLocationAuthorization successcallback triggers too early #185

HuaHub opened this issue Mar 25, 2017 · 9 comments
Labels
investigate Issue requires investigation

Comments

@HuaHub
Copy link

HuaHub commented Mar 25, 2017

cordova.plugins.diagnostic.requestLocationAuthorization(successCallback, errorCallback, mode);

The successcallback triggers too early, resulting in "status" in always "not determined", instead of the user's choice.

@dpa99c
Copy link
Owner

dpa99c commented Mar 27, 2017

Please provide some more information:

  • Cordova platform version (cordova-android/cordova-ios) e.g. [email protected]
  • Platform (Android or iOS)
  • Platform type (device or emulator)
  • Platform version e.g. iOS 10.3
  • Platform details (device type or emulator details) e.g. iPhone 6

@dpa99c dpa99c added the more info needed Further information is requested. If not provided, issue will be closed label Mar 27, 2017
@HuaHub
Copy link
Author

HuaHub commented Mar 27, 2017

Cordova 6.5.0
IOS
Device: iPhone 6
iOS: 10.2.1

@dpa99c
Copy link
Owner

dpa99c commented Mar 27, 2017

I'm unable to reproduce your issue running the example project in the iOS 10.2 Simulator - see this screencast.

Please try building and running the example project and confirm if you get the same result.

@dpa99c dpa99c added awaiting response If no response, issue will be closed and removed more info needed Further information is requested. If not provided, issue will be closed labels Mar 27, 2017
@HuaHub
Copy link
Author

HuaHub commented Mar 29, 2017

Thanks for the screencast.

IOS Platform 4.3.1 btw.
I upgraded to iOS10.3, but the successcallback still runs instantly.

Sorry, I don't have the opportunity to run the example project this week.

@dpa99c
Copy link
Owner

dpa99c commented Apr 4, 2017

Notify with details if still an issue and I will reopen

@dpa99c dpa99c closed this as completed Apr 4, 2017
@0x62
Copy link

0x62 commented May 18, 2017

This is still an issue (encountered myself), however I've found a way to resolve it.

If you use requestLocationAuthorization before calling getLocationAuthorizationStatus, it sees the change of authorization state from undefined to not_determined, and triggers the callback before the user acts on the dialog. If you use getLocationAuthorizationStatus, then request authorization it functions as expected.

This is my (very sloppy) patch for a demo I was working on: https://gist.github.com/0x62/56d6b70aec2d832cf35e4ed01892a590

@dpa99c
Copy link
Owner

dpa99c commented May 18, 2017

Will look into it

@dpa99c dpa99c reopened this May 18, 2017
@dpa99c dpa99c added investigate Issue requires investigation and removed awaiting response If no response, issue will be closed labels May 18, 2017
@0x62
Copy link

0x62 commented May 18, 2017

I've only debugged on iOS, so not sure whether the issue is the same for Android.

ionic: 3.0.0
cordova: 7.0.0
iOS: 10.3.1

@dpa99c dpa99c closed this as completed in 1e6053b May 30, 2017
@dpa99c
Copy link
Owner

dpa99c commented May 30, 2017

@0x62 Thanks for your explanation of the issue - I was able to reproduce it and have fixed it in the above commit, published to npm as v3.6.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Issue requires investigation
Projects
None yet
Development

No branches or pull requests

3 participants