【问题标题】:flex 4.6 : Get the current location (fast as possible)flex 4.6 : 获取当前位置(尽可能快)
【发布时间】:2014-01-02 09:58:31
【问题描述】:

我正在使用 flex 4.6 移动应用程序当我使用 gps 传感器获取当前位置时我的问题需要很长时间在 35 秒的限制内进行 2 次更新我的代码是

            protected function GetGPSposition():void
        {
            //Initialize the location sensor.
            geo = new Geolocation();
            if(! geo.muted){  //gps is enabled
                geo = new Geolocation();
                geo.setRequestedUpdateInterval(10);
                geo.addEventListener(GeolocationEvent.UPDATE, handleLocationRequest);
                geo.addEventListener(StatusEvent.STATUS,handleErrorGPS);
            }
            else if(geo.muted){ //gps is disabled
                    (new GPS2()).open(this, false) ;
                    internetGpsEnable = false ;
                }
        }
            protected function handleLocationRequest(event:GeolocationEvent):void 
        { 

            counter++ ;
            if (counter > 1)
            {
                long = event.longitude;
                lat =  event.latitude;
                internetGpsEnable =true ;
                lblGPS.text = null;
            }
        }

注意:GetGPSposition() 在 creationComplete 中工作 如果有任何方法可以尽快获得经度和纬度,任何人都可以建议我。 提前感谢您的帮助。

【问题讨论】:

    标签: android actionscript-3 apache-flex gps flexbuilder


    【解决方案1】:

    Android 设备的 GPS 在请求省电之前一直处于空闲状态,一旦请求就需要时间进行通信和计算,您无法加快此过程。

    如果您同时拥有精细和粗略定位权限,Geolocation API 应该会在 GPS 解析时报告 Radio/GPRS 位置,但这并不准确。

    我相信你的方法是尽可能快的,而不是在应用启动时调用Geolocation,以确保它始终轮询。

    【讨论】:

      猜你喜欢
      • 2017-08-03
      • 1970-01-01
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      • 2011-07-15
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多