我正在研究GEO LOCATION,我需要找出纬度和经度或国家和州名。我正在使用Flash CS6、AS3和AIR 24.0.0.180版本。它会返回Geolocation.isSupported
是真的,但是当我添加
geo.setRequestedUpdateInterval(1000);
geo.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler);
在Android版本6及更高GeolocationEvent.UPDATE
版本上不会触发,对于版本5,它运行良好。
//In constructor
if (Geolocation.isSupported)
{
geo = new Geolocation();
geo.addEventListener(PermissionEvent.PERMISSION_STATUS, onPerm);
//even adding update and status listeners here also it will not fired.
}
else
{
log.text = "\n Geolocation not supported";
}
stage.addEventListener(MouseEvent.CLICK, onClick);
private function onClick(e:MouseEvent):void
{
geo.requestPermission(); //here it is asking for permission.
}
private function onPerm(e:PermissionEvent):void
{
//Permission event shows GRANTED when i click on allow.
log.appendText("\n PermissionEvent : " + e.status.toUpperCase() + " !geo.muted :"+!geo.muted+"\n");
if (!geo.muted) //true
{
geo.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler); //these events are not fired.
}
geo.addEventListener(StatusEvent.STATUS, geoStatusHandler);//these events are not fired.
}