开发者

Android: myLocationOverlay.runOnFirstFix Too Slow

开发者 https://www.devze.com 2023-04-11 02:01 出处:网络
Does anybody have any ideas in speeding up the process for setting the initial point for Google Maps, centering on your current l开发者_运维百科ocation. This must be possible as it works fine in the n

Does anybody have any ideas in speeding up the process for setting the initial point for Google Maps, centering on your current l开发者_运维百科ocation. This must be possible as it works fine in the native Google Maps app but has a noticeable delay in my custom application where I am using:

myLocationOverlay.runOnFirstFix(new Runnable() {
        public void run() {             
            findMe();
        }           
    });

where find me includes:

if(myLocationOverlay.getMyLocation() != null){
    mapView.getController().animateTo(myLocationOverlay.getMyLocation());
}


As far as I know, the native Maps service and application is loading on system startup and prepares itself in the background wchich makes it load maps faster. You could check it in running processes in the settings. You cloud do the same or make dirty workaround wchich I did once: display progress dialog before everything load (after setContentView in onLoad) and close it after you done everything on the map you need ;)


Are you using only GPS location? If you request the current location based on the network location and accept a little stale values (up to an hour maybe?), you should get the user's location practically immediately.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号