1 Reply Latest reply on Jun 20, 2011 12:22 AM by blazejewicz

    GeoLocation-Samsung Infuse "muted" problem

    RBC

      Anyone have any ideas?  When I try to test the following Geolocation code on my Samsung Infuse, I just get the message from the code below that "Access to GPS has been muted"...even though the GPS is on (ie - use wireless networks and use gps satelilites are both checked on)...I just copied this code verbatim from tour de flex.  I haven't tried on a different phone yet, but will soon.

       

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

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" viewActivate="view1_viewActivateHandler(event)"

      xmlns:s="library://ns.adobe.com/flex/spark" title="GeoLocation">

       

      <fx:Script>

      <![CDATA[

      import flash.sensors.Geolocation;

       

      import spark.components.supportClasses.StyleableTextField;

      import spark.events.ViewNavigatorEvent;

       

      protected var g:Geolocation = new Geolocation();   

       

      protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void

      {

      if (Geolocation.isSupported)

      {

      // Note: un-comment the muted check for android OS, however there is currently a bug on iOS where it will always return

      //      muted and not update the location if left uncommented.

      if (g.muted)

      {

      log.text = "Access to GPS has been muted";

      return;

       

      log.text = "Finding Location...";

      g.addEventListener(GeolocationEvent.UPDATE, onUpdate);

      addEventListener(ViewNavigatorEvent.REMOVING,onRemove);

      }

      else

      {

      currentState = "unsupported";

      lblSupport.text = "Geolocation is not supported on this device.";

      }   

      }

       

      protected function onUpdate(event:GeolocationEvent):void

      {

      trace("Update event called");

      log.text = "latitude = " + event.latitude +

      "\nlongitude = " + event.longitude +

      "\naltitude = " + event.altitude +

      "\nverticalAccuracy = " + event.verticalAccuracy +

      "\nhorizontalAccuracy = " + event.horizontalAccuracy +

      "\nspeed = " + event.speed +

      "\nheading = " + event.heading +

      "\ntimestamp = " + event.timestamp;       

      // auto-scroll the text area to the latest text

      StyleableTextField(log.textDisplay).scrollV = StyleableTextField(log.textDisplay).scrollV+1;

      }

       

      protected function onRemove(event:ViewNavigatorEvent):void

      {

      g.removeEventListener(GeolocationEvent.UPDATE, onUpdate);               

      }

      ]]>

      </fx:Script>

      <s:states>

      <s:State name="normal"/>

      <s:State name="unsupported"/>

      </s:states>

       

      <s:layout>

      <s:VerticalLayout paddingTop="20" paddingBottom="20" paddingLeft="20" paddingRight="20" gap="40"/>

      </s:layout>

       

      <s:Label id="lblSupport" includeIn="unsupported" width="95%"/>

      <s:VGroup width="400" includeIn="normal">

      <s:Label text="Event Log:"/>

      <s:TextArea id="log" editable="false" height="400"/>

      </s:VGroup>

       

      </s:View>