Search code examples
iosactionscript-3air

Geolocation.requestPermission() only works once


I have an app that needs to request permanent access to geolocation permission ( also in the background ) to gather data. At the apps start I do a permission check like so ( simplified )

private static function check():void{
    if (Geolocation.permissionStatus == PermissionStatus.GRANTED){
        onPermGranted();
    }else{

        _geo = new Geolocation();
        _geo.addEventListener(PermissionEvent.PERMISSION_STATUS, onPermission );
        try {
             _geo.locationAlwaysUsePermission = true;
             _geo.requestPermission();
        } catch(e:Error){
              onError(e);
        }
    }
};
private static function onPermission(e:PermissionEvent):void{
    trace("GeolocationUtil::onPermission: "+e.status);
};

The first time the app starts and this gets called and works. Now if I quit the app, then change the permission to "never", and restart the app, I can see that

_geo.requestPermission();

gets called, but there is no response whatsoever and I do not get the iOS permissions dialog as well.

Any ideas? Thanks a lot!


Solution

  • The system will only ask once for the permission even if you uninstall your app and reinstall it again, looks like it has a system level cache, Try go to Setting -> General -> Reset -> Reset Location & Privacy