1

I am working on GEO LOCATION, i need to find out the Latitude and Longitude or Country and State Names. I am using Flash CS6, AS3 and AIR 24.0.0.180 version. It will return Geolocation.isSupported is true but when i am adding

geo.setRequestedUpdateInterval(1000);
geo.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler);

The GeolocationEvent.UPDATE is not fired on Android version 6 and more, for version 5 it is working fine.

//In constructor
if (Geolocation.isSupported) 
        { 
            geo = new Geolocation();
            geo.addEventListener(PermissionEvent.PERMISSION_STATUS, onPerm);
            //even adding update and status listeners here also it will not fired.
        } 
        else 
        { 
            log.text = "\n Geolocation not supported"; 
        }
stage.addEventListener(MouseEvent.CLICK, onClick);

private function onClick(e:MouseEvent):void
    {
        geo.requestPermission(); //here it is asking for permission.
    }

private function onPerm(e:PermissionEvent):void
    {
        //Permission event shows GRANTED when i click on allow.
        log.appendText("\n PermissionEvent : " + e.status.toUpperCase() + " !geo.muted :"+!geo.muted+"\n");
        if (!geo.muted) //true
        { 
            geo.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler); //these events are not fired. 
        } 
        geo.addEventListener(StatusEvent.STATUS, geoStatusHandler);//these events are not fired.
    }
sivabalaji
  • 43
  • 1
  • 8
  • Permissions schema changed since Android 6: https://stackoverflow.com/questions/44756809/capture-permission-granted-complete-event/44765197#44765197 You need to request user's permission and handle the answer manually: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Geolocation.html#requestPermission() – Organis Aug 07 '17 at 10:09
  • @Organis even though i am adding `geo.requestPermission();` and the status shows **GRANTED** but the `GeolocationEvent.UPDATE` is not fired. :( – sivabalaji Aug 07 '17 at 11:33
  • Read the **UPDATE** event description, there are certain conditions to be met before it is dispatched: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Geolocation.html#event:update – Organis Aug 07 '17 at 13:24
  • Hi @Organis, Thank you for your reply, even though follow same procedure also i am unable to find `GeolocationEvent.UPDATE` and `StatusEvent.STATUS` listeners when i granted the permission. `geo.addEventListener(PermissionEvent.PERMISSION_STATUS, onPerm);` on this i am getting `GRANTED` but listeners are added also i am not getting. Please check, I added my latest code. – sivabalaji Aug 08 '17 at 07:18
  • Well. In theory your code is absolutely correct. After permission is granted the fact of subscription to the event should fire the event for the first time. You might are also want to read some useful links and known issues with Google > as3 geolocation troubleshooting. – Organis Aug 08 '17 at 08:04
  • Thank you, But in some devices `StatusEvent.STATUS` is shows enabled with out enable also but when we enable location, it is showing correctly, and in some devices `StatusEvent.STATUS` is working fine but `GeolocationEvent.UPDATE` is not fired. But in major devices working fine. – sivabalaji Aug 08 '17 at 12:59

0 Answers0