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

feat(android): check location service before permission #280

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kumo01GitHub
Copy link

@kumo01GitHub kumo01GitHub commented Oct 12, 2024

Platforms affected

Android

Motivation and Context

  • This is change for check Location Service enabled before request permission. For now when the location service is unavailable, the plugin request permission, open dialog and wait for timeout. Referencing Note: Browser permission VS OS permission in W3C, I interpreted location service availability is similar to OS permission and it should return PERMISSION_DENIED.
  • In W3C, it looks no distinction between fine and coarse location permissions. And WebView return coarse location ignoring enableHighAccuracy when denied permission for fine location.

Description

  • When request high accuracy location but only granted coarse location, onRequestPermissionResult() return PluginResult.Status.OK
  • check location service before permission.

Testing

I checked with virtual device location service on/off.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@kumo01GitHub kumo01GitHub changed the title Feature/location service (android) feat: check location service before permission Oct 12, 2024
@kumo01GitHub kumo01GitHub changed the title (android) feat: check location service before permission feat(android): check location service before permission Oct 12, 2024
@breautek
Copy link
Contributor

image

I do agree that if the OS level has GPS disabled, then returning a PERMISSION_DENIED is more reflective of the W3C standard.

Note that the android tests is failing does not appear to be related to this PR, I think the CI configs needs to be updated. I'll try to do that sometime soon and once merged, this PR will need to be rebased.

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

Successfully merging this pull request may close these issues.

2 participants