Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Laggy mapview - why is the native map rendering without interaction?
Started by coronalabs613 Nov 30 2014 10:44 PM

5 replies to this topic
map mapview performance native debug android frame lagging slow
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

coronalabs613

[GLOBAL: userInfoPane.html]
coronalabs613
  • Observer

  • 3 posts
  • Corona SDK

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
 
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:
 
And then went back into the app:
 
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:
 
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...

Attached Files



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,660 posts
  • Enterprise

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



[TOPIC: post.html]
#3

jn32t

[GLOBAL: userInfoPane.html]
jn32t
  • Observer

  • 2 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

coronalabs613

[GLOBAL: userInfoPane.html]
coronalabs613
  • Observer

  • 3 posts
  • Corona SDK

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...



[TOPIC: post.html]
#5

pspk

[GLOBAL: userInfoPane.html]
pspk
  • Observer

  • 15 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#6

jn32t

[GLOBAL: userInfoPane.html]
jn32t
  • Observer

  • 2 posts
  • Corona SDK

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. =)




[topic_controls]
[/topic_controls]