0 Replies Latest reply on Jan 31, 2012 9:42 PM by bharthviji

    Flex Mobile Geo Location Update event does not call

    bharthviji

      Hi Friends ,

       

      Thanks for advance

       

      Geo Location update event does not trigger

       

      My code is

       

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

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                          xmlns:s="library://ns.adobe.com/flex/spark" title="Geo Location" viewActivate="creationCompleteHandler(event)">

                <fx:Declarations>

                          <!-- Place non-visual elements (e.g., services, value objects) here -->

                </fx:Declarations>

                <fx:Script>

                          <![CDATA[

                                    import flash.events.GeolocationEvent;

                                    import flash.sensors.Geolocation;

       

                                    import mx.events.FlexEvent;

       

                                    import spark.events.ViewNavigatorEvent;

       

       

                                    public var geoLocation:Geolocation= new Geolocation();

                                    public function creationCompleteHandler(event:ViewNavigatorEvent):void{

                                              if (Geolocation.isSupported)

                                              {

                                                        if(! geoLocation.muted){

                                                                  gpsStatus.text="Finding location";

                                                                  geoLocation.setRequestedUpdateInterval(1000);

                                                                  geoLocation.addEventListener(GeolocationEvent.UPDATE, onLocationRequest);

                                                                  addEventListener(ViewNavigatorEvent.REMOVING,onRemove);

                                                        }

                                              }

                                    }

                                    public function onLocationRequest(event:GeolocationEvent):void{

                                              gpsStatus.text="GPS UPdate event triggered";

                                    }

                                    protected function onRemove(event:ViewNavigatorEvent):void

                                    {

                                              geoLocation.removeEventListener(GeolocationEvent.UPDATE, onLocationRequest);               

                                    }

                          ]]>

                </fx:Script>

                <s:TextInput editable="false" id="gpsStatus" width="100%"/>

      </s:View>