Skip to content

Geolocation silently fails on Android 6+ #20

@andygup

Description

@andygup

Starting at Android 6.0 (a.k.a Android M), the sample apps in this repo that require geolocation will fail silently even if the AndroidManifest file has all the correct permissions.

If you are doing remote debugging, you may not see any errors in the browser console. Logcat, however, will show the error E/cr_LocationProvider: Caught security exception while registering for location updates from the system. The application does not have sufficient geolocation permissions.

This is happening because of significant security changes at Android 6. Android 6 and above requires that permissions be granted at runtime as compared to installation-time. You can read more about the technical aspects here in the native API docs. Before Android 6 you could simply set up the AndroidManifest then fire and forget because permissions were established when the user installed the app. This is no longer the case.

Instructions for turning on Geolocation in case of Android 6 failure
You'll need to follow these steps in order to get geolocation working again:

  • Navigating to Settings > Apps > QuickstartMap > Permissions. Your permissions settings will say something like No permisions granted.
  • Click on Permissions you'll see that you can activate Location and activate it.
  • Go back to the AppInfo screen of QuickstartMap and select the ForceStop button to kill the application.
  • Exit Apps and then restart you application.

Resolution

This needs to be documented and a plugin recommended. This may also include adding additional sample(s) to demonstrate working with a security plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions