Hi
In the following code I am able to plot the Location using Latitude and Longitude but the requirement is
in an Android Emulator on launch of the application I need google map to display the users current location,
How can this be achieved ??? I tried to get the Latitude and Longitude of the current position using
geoLocation class by I am not able to get that working,
<?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="Home">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.google.maps.LatLng;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.controls.PositionControl;
import com.google.maps.controls.ZoomControl;
import flash.sensors.Geolocation;
private var myGeo:Geolocation;
protected function showBtn_clickHandler(event:MouseEvent):void
{
if(Geolocation.isSupported == 'true')
{
myGeo = new Geolocation();
myGeo.setRequestedUpdateInterval(100);
myGeo.addEventListener(GeolocationEvent.UPDATE, onUpdate);
}
else
{
myTextArea.text = "Device Not Supported";
}
}
private function onUpdate(event:GeolocationEvent):void
{
myTextArea.text += "Hi"+ "/n"+ event.latitude.toString() + "/n" +
event.longitude.toString();
}
protected function myMap_mapevent_mapreadyHandler(event:MapEvent):void
{
myMap.setCenter(new LatLng(24,58),9,MapType.NORMAL_MAP_TYPE);
myMap.addControl(new ZoomControl);
myMap.addControl(new PositionControl);
}
]]>
</fx:Script>
<s:Button id="showBtn" label="Show" click="showBtn_clickHandler(event)"/>
<s:TextArea id="myTextArea" width="100%" height="50%" />
<maps:Map id="myMap" width="100%" height="50%"
xmlns:maps="com.google.maps.*"
sensor="true"
key="ABQIAAAA2Fwy6HLBheYSAWRBEZKwEhRLum8XdHegG17d4EymNgK0o7h2qRRWVBVQywiGHEiGtKahjfGW8xxc RA"
mapevent_mapready="myMap_mapevent_mapreadyHandler(event)"
url="http://www.xyz.com"/>
</s:View>