[Location Plugin] [Location Plugin] [Android] Mobile app doesn't ask for geolocation permission.

Forge Component
Published on 25 Aug by OutSystems R&D
28 votes
Published on 25 Aug by OutSystems R&D

I've implemented a GetLocation method in my mobile app. However when running it, I get a 'application does not have sufficient geolocation permissions' error on my Android Phone.

It never pops up a 'give location permissions' dialog even after rebuilding the APK and reinstalling a few times. In Phone Settings there is no location permission that is turned off or so for this Application.

It works fine on web or OutsystemsNow. Not able to test on iOS.


Oneplus 6 - A6003

Android v 10

OxygenOS v OP6_O2_BETA_35

It seems to be the issue with the cordova plugin https://github.com/ionic-team/ng-cordova/issues/743

Reinstall the component, and then rebuild the APK.

I have reinstalled the plugin and rebuilt the APK, rebooted my phone, to no avail. Still get the same error message.

Hello Fred,

I don't think that this is a problem with the plugin neither with the APK. Actually, I'm using this plugin in one of my applications and I have it working in several devices. My code is pretty much equal to yours...

Did you try in another device?

I had a similar problem with a device back in the days, I turned off and on all of the location permissions and it worked afterwards. It was also an Android device.

Kind regards,

Rui Barradas

Hello, in our last project we figure out that we need to use AndroidPermissionPlugin before asking location. Try it, from Forge.


I do not have another mobile device to test it on unfortunately, @Rui do you mean to manually turn off and on location permissions for every app? My app isn't even in that long list so not sure how that would help.

@Roman, I have tried your advice and implemented the AndroidPermissionsPlugin like so:

I have then rebuilt the APK and reinstalled on my device (twice) and now the Permissions plugin is not available and I still get the application does not have sufficient geolocation permisssions message of course.

This indicates to me that the Permissions plugin doesn't get included in the APK somehow? I had a similar problem with the ToDo app in the mobile dev course where the camera plugin didn't get included in the APK either but I never really got to solving that problem, it was on the same device.

This is how we use it and it works great. When the permission plugin is not available, I think you cannot continue to check Geo plugin - it will be always unavailable.

Let me know if you solved it.


And the asked and requested permission is "Entities.AndroidPermission.ACCESS_COARSE_LOCATION"

I don't doubt it works great in your case Roman, but I have not solved my problem, why would the permissions plugin be unavailable?

Really, there is no need to "CheckAndroidPermissionsPlugin", it is done as first in "hasPermission" action. And it will fails only when Cordova is not defined or when Cordova has not a permission plugin.

Requests your device for location permission (on the requestPermission action) before it raise an exception on CheckLocationPluogin? I think it requests it only first time and if you denied it, it will never ask again. Try to not uninstall the application, but only remove all application data. It will reset all permissions as well.

Roman I don't quite understand, I understand that I don't necessarily need to use CheckAndroidPermissionsPlugin, but in this case I think it is good that I've done it, as it results in an error. Are you saying there is a problem with Cordova on my phone? I use another Cordova plugin, InAppBrowser without problems.

I do request for permission before checking the location plugin, as you can see in my screenshot in a previous comment.

I have not seen a permissions popup on my phone for this application before and would probably not have denied it. In any case, the location permission does not show up in my phone settings, see screenshot. 

I did remove all application data but this did not help, there are no permissions to reset.

So I still have two remaining questions:

 1. Why is the CheckPermissions plugin not available on my Android device?

 2. Why does the LocationPlugin not ask for permission on my Android device, has it been broken since android 6?

Ok so I have been able to test the APK in an emulator in Android Studio, I emulated a Pixel 2 on Android 10.

The permission request worked, I received a dialog box and it stored the location correctly. For completeness I denied the permission in settings and requested again, screenshots posted below. Both of these features do not work on my phone. Compare with screenshot in previous comment. 

Could this be an issue with my Phone, how to continue from here?

Edit: Upon further testing, I now know that the InAppBrowser Plugin is also not available on my Phone. This is in contrast to what I previously thought.