Skip to main content
Participant
July 7, 2013
Answered

Air 3.7 Flash Builder 4.6

  • July 7, 2013
  • 2 replies
  • 1096 views

I am trying to get the GeoLocation to work on an iPhone 5

This current Config is working under Android

On  IPhone I keep getting Muted

Here is my app.xml

Can you let me know where i am going wrong..

Thanks for your time..

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<application xmlns="http://ns.adobe.com/air/application/3.7">

          <id>com.xxxx.xxxxxx.xxxxxxx</id>

<filename>Waypoints</filename>

<name><text xml:lang="en">Waypoints SE</text></name>

<versionNumber>2.2.0</versionNumber>

<versionLabel>Pre Release 2.24</versionLabel>

<autoOrients>false</autoOrients>

        <fullScreen>true</fullScreen>

        <visible>true</visible>

        <softKeyboardBehavior>none</softKeyboardBehavior>

<….

….>

 

<iPhone>

<InfoAdditions>

<![CDATA[

          <key>UIDeviceFamily</key>

                    <string>1</string>

          <key>UIRequiredDeviceCapabilities</key>

               <string>location-services</string>

        <key>UIRequiredDeviceCapabilities</key>

                      <string>gps</string>   

         <key>UIBackgroundModes</key>

                       <string>location</string>

         <key>UIApplicationExitsOnSuspend</key>

                           <true/>

  ]]>

</InfoAdditions>

<requestedDisplayResolution>high</requestedDisplayResolution>

</iPhone>

public function start_gps():void

                    {

                              geo = new Geolocation();

                              if (Geolocation.isSupported)

                              {

  //Initialize the location sensor.

  // So if a device has GPS and is not on

  // the Device is give you the GPS Coord

  // from the network carrier

  // if the GPS is on the Polling is Much faster

  // than coming from the network carrier.

                                        if(! geo.muted)

                                        {

  //          trace("GPS CLASS GPS is ENABLED " );

                                                  gpsStatus = 'ENABLED';

                                                  geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

                                                  this.dispatchEvent(new Event("GPSON"));

                                                  this.change_refresh_rate(0);

                                        }

                                        else

                                        {

  //          trace("GPS CLASS GPS is ENABLED " );

                                                  gpsStatus = 'MUTED';

                                                  dispatchEvent(new Event("GPSOFF"));

                                        }

                              }

  else

                              {

  // trace("GPS CLASS GPS Hardware not Available " );

                                        gpsStatus = 'NA';

                                        this.dispatchEvent(new Event("GPS_ABSENT"));

                              }

                    }

This topic has been closed for replies.
Correct answer PopeOfHockey

Finally Figure it out..

geo = new Geolocation();

geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

has to be executed before checking if it is muted.

geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

Is what requests permissions from the phone to use the gps.

Hope this saves someone alot of time.

Tested With Flex 4.9.0 Air 3.8 Beta.

2 replies

Adobe Employee
July 8, 2013

This thread might be of your help - http://forums.adobe.com/message/4964140?tstart=0 (see last post)

Projectitis
Inspiring
July 7, 2013

Have you tried this previously and pressed the button to deny access to location services from your app?  The docs seem to indicate that the 'muted' status means that the user has not accepted location services yet (or, has denied in the past).

On the phone, is your app listed in 'Settings > Privacy > Location Services'?

Participant
July 8, 2013

No the app is not listed in the Location Services

How do I add it there

PopeOfHockeyAuthorCorrect answer
Participant
July 8, 2013

Finally Figure it out..

geo = new Geolocation();

geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

has to be executed before checking if it is muted.

geo.addEventListener(GeolocationEvent.UPDATE, onLocationUpdate);

Is what requests permissions from the phone to use the gps.

Hope this saves someone alot of time.

Tested With Flex 4.9.0 Air 3.8 Beta.