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

locationAuthorizationMode is not exposed #90

Closed
nicoabie opened this issue Jun 24, 2016 · 4 comments
Closed

locationAuthorizationMode is not exposed #90

nicoabie opened this issue Jun 24, 2016 · 4 comments
Labels
TODO Something needs doing

Comments

@nicoabie
Copy link

cordova.plugins.diagnostic.locationAuthorizationMode is undefined

@dpa99c
Copy link
Owner

dpa99c commented Jun 25, 2016

locationAuthorizationMode is exposed here by the iOS plugin API and can be seen in use here in the example app - you can confirm this is working by building and running the example project .

If you're still have issues with your own code, please post more useful information such as the platform version, cordova cli version, plugin version and code snippet illustrating usage.

@dpa99c dpa99c added the more info needed Further information is requested. If not provided, issue will be closed label Jun 25, 2016
@nicoabie
Copy link
Author

Sorry for the lack of info.
The problem is on android, the method requestLocationAuthorization is supposed to work on android and ios, but just on ios locationAuthorizationMode is defined.
Therefore using it on android causes errors, the documentation gives an example for each platform and it was my bad undestanding that thought there ain't no problem using the same code for both.
That is not the case but it think it should be.

@dpa99c
Copy link
Owner

dpa99c commented Jul 1, 2016

OK, I think I understand your issue. Since on Android locationAuthorizationMode makes no sense (since there's not concept of ALWAYS or WHEN_IN_USE like on iOS), then there wouldn't be any sensible values to define within it, but if it were defined as an empty object, then any references to keys inside it would evaluate to undefined but at least this wouldn't raise an error.

So for the next version I will add for the Android version:

cordova.plugins.diagnostic.locationAuthorizationMode = {};

This will allow you to use the same code on both Android and iOS:

cordova.plugins.diagnostic.requestLocationAuthorization(
    onSuccess, 
    onError, 
    cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS
);

@dpa99c dpa99c added TODO Something needs doing and removed more info needed Further information is requested. If not provided, issue will be closed labels Jul 1, 2016
@nicoabie
Copy link
Author

nicoabie commented Jul 1, 2016

Exactly Dave. I understand it makes no sense in android, it is just to make it easier to use.
Thanks.

@dpa99c dpa99c closed this as completed in 9af61e5 Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO Something needs doing
Projects
None yet
Development

No branches or pull requests

2 participants