Skip to main content
Known Participant
September 17, 2018
Question

geolocation on iphonex not working

  • September 17, 2018
  • 1 reply
  • 912 views

i am using the "show geolocation" snippet on IPHONE X with animate  cc 2018 AIR30 however i keep getting the ""Geolocation is not supported on this device." message.

need help

This topic has been closed for replies.

1 reply

rfatima
Participating Frequently
September 18, 2018

Hi There,

We tried using the "show geolocation" snippet with animate cc 2018 on iPhone X AIR30 (iOS 11.4.1), it is working fine at our end.

Please provide us with more details of the exact steps or sample code you are using.

Thanks,

Rabab | Adobe AIR Engineering

udikAuthor
Known Participant
September 18, 2018

thank you

this is the package used.

when test on device via usb i can see only the frame - no content.

 

package

{

    import flash.display.Sprite;

    import flash.display.StageAlign;

    import flash.display.StageScaleMode;

    import flash.events.GeolocationEvent;

    import flash.events.MouseEvent;

    import flash.events.StatusEvent;

    import flash.sensors.Geolocation;

    import flash.text.TextField;

    import flash.text.TextFormat;

   

    public class GeolocationTest extends Sprite

    {

       

        private var geo:Geolocation;

        private var log:TextField;

       

        public function GeolocationTest()

        {           

            super();

            stage.align = StageAlign.TOP_LEFT;

            //stage.scaleMode = StageScaleMode.FULL

//NO_SCALE;

            setUpTextField();

           

            if (Geolocation.isSupported)

            {

                geo = new Geolocation();

                if (!geo.muted)

                {

                    geo.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);

                }

                geo.addEventListener(StatusEvent.STATUS, geoStatusHandler);

            }

            else

            {

                log.text = "Geolocation not supported";

            }

        }

       

        public function geoUpdateHandler(event:GeolocationEvent):void

        {

            log.text = "latitude : " + event.latitude.toString() + "\n";

            log.appendText("longitude : " + event.longitude.toString() + "\n");

        }

       

        public function geoStatusHandler(event:StatusEvent):void

        {

            if (geo.muted)

                geo.removeEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);

            else

                geo.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);

        }

       

        private function setUpTextField():void

        {

            log = new TextField();

            var format:TextFormat = new TextFormat("_sans", 24);

            log.defaultTextFormat = format;

            log.border = true;

            log.wordWrap = true;

            log.multiline = true;

            log.x = 10;

            log.y = 10;

            log.height = stage.stageHeight - 20;

            log.width = stage.stageWidth - 20;

            log.addEventListener(MouseEvent.CLICK, clearLog);

            addChild(log);

        }

        private function clearLog(event:MouseEvent):void

        {

            log.text = "";

        }

    }

}

Flipline
Inspiring
September 18, 2018

Have you added all of the NSLocation tags in the InfoAdditions section of the application XML for iOS?  I believe if you don't add these, the iPhone will say that it's not supported:

<InfoAdditions>

  <![CDATA[

  <key>NSLocationAlwaysUsageDescription</key>

  <string>Sample description to allow geolocation always</string>

  <key>NSLocationWhenInUseUsageDescription</key>

  <string>Sample description to allow geolocation when application is in foreground</string>

  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>

  <string>Sample description to allow geolocation always and when application is in foreground</string>

  ]]>

  </InfoAdditions>