Laggy mapview - why is the native map rendering without interaction?

Hi folks, I hope someone from the dev’s team picks this up and give us a hint.

I am looking for a solution that runs one code on several platforms. Corona seems to do that pretty well but then I found a major problem for us. I was playing around with GPS positions and a map (native map view that is) and always felt the Android build a bit laggy. Can’t describe it better, it is just not as smoth as the Google Maps application nor any app like aroundme or such. And it was even worse: as I drag with one finger, it is quite laggy, yet once I start to zoom (meaning with two fingers) it speeds up to an usual speed you’d expect.

So I jumped into some debugging and got rid of every piece of code but the four lines left:

myMap = native.newMapView( 20, 20, display.contentWidth - 50, display.contentHeight - 50 ) myMap.x = display.contentCenterX myMap.y = display.contentCenterY - 50 myMap:setCenter( 52.518611, 13.408333 )

I am running a Samsung Galaxy S3 with no specials on it. Installed the app and made a video on the mapview’s behavior, see on Youtube (I am sorry for filming it vertically :D) 

https://www.youtube.com/watch?v=N1oPrRuNZ2M

As you see, it has this weird lag and it is still a lot smoother in zoom mode, even if you don’t really zoom in.

Now I activated the flash-on-redraw tool for developers:

https://dl.dropboxusercontent.com/u/9831256/share/corona/developer.jpg

And then went back into the app:

https://www.youtube.com/watch?v=FXxOLq_JOX4

For some reason the native map forces permanent redraws of the entire screen… ?! Well then the lag is no real surprise. But why the hell does it do that?!?

To make sure it is not a common thing I also recorded Google Maps:

https://www.youtube.com/watch?v=0vluF2Cr_SE

And there is no more drawing as you stopped zooming or moving. May take some seconds, tho.

So what’s wrong with Corona’s magic? Any chance to fix that? Because if I want non-fluid apps which eats up my CPU and battery I could also use HTML5…

I got an answer from Engineering.  We do not use the native SDK on android, but are running through a webView.  This may seem odd, but Google requires that devices come pre-installed with Google Play.  This eliminates any Amazon or B&N device.  Since we want to support as many devices as possible, we went the webView route.  This is the cause of the updates.

Rob

If webView is the desired route, how do you get event listeners on stuff like markers e.g.?

I know that there are certain workarounds around like adding links to the markers and parse their body to get the event.

To me this just doesn’t look as elegant as addNewMarker+eventlistener function does.

Any chance you add say a second (really native) map in parallel, which just works on the right devices?

For now, we just have one chance: use our own webview and writing files into the flash storage (which really sucks). Also the callback might not always work as fine as it should with those webviews…

Nice detective work coronalabs613!

I too have a need for a more responsive maps functionality with Android. Many enterprise apps rely on the maps function, and the current performance on android is poor (also seems buggy when displaying callouts on marker selection) - it makes my app look so bad that I have to consider doing a native app  :(.

 I strongly second the request for a native map for applicable android devices. 

If corona itself is not going this way it’s up to us to build it on ourselves.

I’ve looked around a bit and the best idea so far is to puzzle together “customMapView” + “LuaToHTML” as a new widget.

Feel free to go for it. =)

I got an answer from Engineering.  We do not use the native SDK on android, but are running through a webView.  This may seem odd, but Google requires that devices come pre-installed with Google Play.  This eliminates any Amazon or B&N device.  Since we want to support as many devices as possible, we went the webView route.  This is the cause of the updates.

Rob

If webView is the desired route, how do you get event listeners on stuff like markers e.g.?

I know that there are certain workarounds around like adding links to the markers and parse their body to get the event.

To me this just doesn’t look as elegant as addNewMarker+eventlistener function does.

Any chance you add say a second (really native) map in parallel, which just works on the right devices?

For now, we just have one chance: use our own webview and writing files into the flash storage (which really sucks). Also the callback might not always work as fine as it should with those webviews…

Nice detective work coronalabs613!

I too have a need for a more responsive maps functionality with Android. Many enterprise apps rely on the maps function, and the current performance on android is poor (also seems buggy when displaying callouts on marker selection) - it makes my app look so bad that I have to consider doing a native app  :(.

 I strongly second the request for a native map for applicable android devices. 

If corona itself is not going this way it’s up to us to build it on ourselves.

I’ve looked around a bit and the best idea so far is to puzzle together “customMapView” + “LuaToHTML” as a new widget.

Feel free to go for it. =)