I tried to use the “addMarker” to a MapView iOS everything works perfectly but the marker does not appear on Android…
have you any idea how to bring up the markers?
I tried to use the “addMarker” to a MapView iOS everything works perfectly but the marker does not appear on Android…
have you any idea how to bring up the markers?
There’s some android bugs relating to setGroupRegion() and removeAllMarkers() on android. It appears that if you addMarker within 700-1500ms of calling either of those, the marker may or may not appear.
It appears to be related to your devices internet connection speed in contacting google maps - on wifi, less time is needed, No idea if coronaLabs is aware of the cause of this behavior, or if they are planning to fix it.
Some people report putting in a delay after calling those, and before adding markers works on android. I’ve seen this as well, specifically on a galaxy s3 running droid 4.3.
This sounds like a rendering bug with Google Maps. That is, we do successfully add the markers to the map, but Google Maps does not always redraw the canvas. In this case, pinch zooming the map will force it to redraw the canvas and show the markers you’ve added.
So, can you try pinch zooming your map after adding the marker?
Just pinch zoom out and then pinch zoom back in. If that displays the marker, then that proves that this is a rendering bug in Google Maps that we have to work-around on our end. (I say this because I’ve ran into this before.)
Also, I’m pretty sure that this is not related to Internet connection speed. This is because we actually queue all map operations such as setting the region, adding markers, removing markers, etc. and only execute those operations once we’ve successfully loaded the map. We’ve been doing it this way since the first release of our map feature on Android. We have to do it this way because the time to load a map varies wildly between devices and due to connection speeds.
I just test for 30 minutes straight, and no malformed markers on screen are showing up today it appears… (I was occasionally getting markers zoomed up / clipped in half, etc). If it happens again, I’ll grab a couple screenshots, but sounds like that would be googles side you’re saying. Maybe google has been messing around with some map stuff and that particular issue is resolved now.
However, I’ve got a mapView or two that still show no markers on sporadic occasions, with no sdk errors reported (addMarker is happy, etc)… Zooming doesn’t show any pins either (across the globe). Still having difficulty pinning down consistent circumstances. If I get anything concrete, I’ll re-post with something – screenshots, code… something to chew on. Sorry for all the kvetching.
So, just a quick question Joshua – the sdk is not rendering any part of the mapView, it’s all google? The pins and map aren’t on different draw surfaces, being arranged top/bottom by the sdk, or anything like that - it’s 100% google?
Also, I note you say the pins are added after the map is reported loaded… If google never replies, or the reply is lost, it sounds like the pins never get added… If the map was draw, then it would appear there were no pins… Hmm. Can’t think of a way I could find out if that was the case.
We actually render maps via a WebView on Android. We do this because not all Android devices support Google’s native maps because there is a licensing/royalty cost that the manufacturer would have to pay. Case in point, the Kindle Fire tablets.
We actually hard coded are maps implementation to use version 3.9 of Google Maps. This was to (theoretically) avoid any breaking changes that Google may make in future revisions since at the time that version passed all of our Google Map tests. That said, I suppose it could still be possible that Google might have accidentally introduced a breaking change to that version unintentionally, because I don’t recall the above mentioned issues being a problem before.
mpappas, since you’re an Enterprise user, then you can actually see the JavaScript side of our map implementation for Android in case you’re curious of how it works. You can find this file under…
./CoronaEnterprise/Corona/android/lib/Corona/res/raw/corona_map_view.html
Most developers use the map’s “idle” event to determine that the map has finished loading, which is what we use. I’ve never seen it fail actually and I’ve tested under extreme conditions such as zero internet access and loss of Internet access. The markers are drawn locally to the canvas and I don’t believe it involves a request to the Google Maps servers.
So, were you only seeing this issue when executing these operations on startup or when first creating the map?
Or is this marker issue happening sporadically at runtime?
OK, got the random / sporadic malformed pin bug… On this map I had added 5 or so pins, and only 1 showed up (boston area). It is scaled a little too big for one, and the alpha looks like 0.05 or something, so you have to squint a little, but you can tell 1 pin tried to show up (boston area)…
http://www.vipah.com/GalaxyS3Pins.png
No idea if this is related to the "no pins’ at all issue… 5 pins were added to this map. This happened after a10 minute testing session, and then downgrading the connection from wifi to cell… A few more minutes, and then this screen showed up.
That faint marker pin suggests that this is a rendering bug with Google Maps that we have to work-around.
And you’re saying that zooming in/out doesn’t resolve it, correct?
Does tapping where the markers are supposed to be cause the annotation to appear/disappear?
I’m not sure what else you can you do to force it to render. In my experience, panning the map won’t force a redraw. I’m just trying to think of some ways to force Google Maps to work and provide you a work-around… because so far, it looks like we are successfully adding the markers to the map, but Google Maps is sometimes failing to draw them. *sigh*
The mapMarker issues on both IOS & Android are very challenging. In this case can you kindly confirm if you were using custom marker images or relying on what the OS supplies? I just found some weird behavior on IOS when I supply the markers. Android seems to be immune to that issue.
@Joshua – I didn’t try zooming on that screenshot :( On the cases where no marker shows, zooming and tapping markers does produce results – darn, wish I tired on the malformed marker… Been testing for another 30 minutes, and haven’t repeated the malformed marker again. But the pins stopped appearing on some maps (once they stop, they never come back on those mapviews without relaunching app).
Going to test some more, and see if I can get another malformed one and try zooming, tapping to see if it affects it (which would mean it is a different bug, for one thing). I’ll repost in this thread if if there’s anything more I can find out to chew on. Thanks for all you help Joshua!
@ksan This on an s3 running droid 4.3. More details are:
Default markers
I’m using 5 mapviews, making various mapviews invisible as the user switches screens (to save initial loading times later)
Markers typically added after a removeAll() and setRegion() call
Ocasionally seeing a malformed marker (like the image above)
Somewhat more frequently having no pins appear, once this happens, pins never appear again on that mapview (although others keep working)
Yikes. That sounds pretty bad. Almost as bad are the custom markers on IOS. See below :
That looks like a center positioning of the marker, but using a marker that requires bottom justification yes? It seems to be scaling and rotating ok.
Yup. Don’t mean to pull this thread off topic but you are right. When custom marker is supplied it is not centered the same as OS supplied markers.
thanks to all expecially to mpappas!
the delay works fine!
good job
ksan, your iOS marker placement issue is a totally different issue. Our team has confirmed it to be a bug and added it to the queue to be addressed later (no ETA yet). I’d prefer to keep this thread focused on the Android issue mentioned above to avoid confusing matters. Mostly because I think the Android issue mentioned can actually be work-around on your guys’ end so that you won’t have to wait for a fix from us.
maucel, mpapas, while adding a marker based on a timer might seem to resolve this issue, I bet you that it won’t always work. Not trying to be difficult, but I’m quite positive that this is a rendering bug with Google Maps like I was saying above. I say this because we ran into several rendering issues just like this that we had to resolve before releasing the first version of our maps feature on Android. So, if it is a rendering bug like I was saying, then you can work-around it by forcing the map view to rescale via the setRegion() function.
mpapas, since you’re an Enterprise user, you can actually see our JavaScript code for our map view which I pointed to you in a post up above. If you look at the script’s functions that removes markers, you can see where we’re working-around Google Map’s rendering bug there by rescaling the map, just like how I recommended in the above paragraph. You see, during testing and before we released our maps feature, our testers came to the same false conclusion that removeMarker() and removeAllMarkers() would not always work… but it turned out that the markers were actually being removed from the map in memory but Google Maps would not always redraw its canvas, leaving the removed marker images onscreen. The solution was for us to force a redraw by zooming in/out of the map, but so quickly that you would never notice it. Kind of a pain really, but Google’s bugs are our bugs and we have to do what it takes to make it work.
Absolutely! I apologize for the off topic post.
No problem! Since you’re working on maps anyways, I’m sure this Android issue affects you as well. Like I was saying above, I’m quite positive that calling setRegion() will work-around the marker rendering issue on Android. No delay via timers should be necessary.
Sure thing! The more the issues are looked into the better. Thanks for your efforts to help.
There’s some android bugs relating to setGroupRegion() and removeAllMarkers() on android. It appears that if you addMarker within 700-1500ms of calling either of those, the marker may or may not appear.
It appears to be related to your devices internet connection speed in contacting google maps - on wifi, less time is needed, No idea if coronaLabs is aware of the cause of this behavior, or if they are planning to fix it.
Some people report putting in a delay after calling those, and before adding markers works on android. I’ve seen this as well, specifically on a galaxy s3 running droid 4.3.
This sounds like a rendering bug with Google Maps. That is, we do successfully add the markers to the map, but Google Maps does not always redraw the canvas. In this case, pinch zooming the map will force it to redraw the canvas and show the markers you’ve added.
So, can you try pinch zooming your map after adding the marker?
Just pinch zoom out and then pinch zoom back in. If that displays the marker, then that proves that this is a rendering bug in Google Maps that we have to work-around on our end. (I say this because I’ve ran into this before.)
Also, I’m pretty sure that this is not related to Internet connection speed. This is because we actually queue all map operations such as setting the region, adding markers, removing markers, etc. and only execute those operations once we’ve successfully loaded the map. We’ve been doing it this way since the first release of our map feature on Android. We have to do it this way because the time to load a map varies wildly between devices and due to connection speeds.
I just test for 30 minutes straight, and no malformed markers on screen are showing up today it appears… (I was occasionally getting markers zoomed up / clipped in half, etc). If it happens again, I’ll grab a couple screenshots, but sounds like that would be googles side you’re saying. Maybe google has been messing around with some map stuff and that particular issue is resolved now.
However, I’ve got a mapView or two that still show no markers on sporadic occasions, with no sdk errors reported (addMarker is happy, etc)… Zooming doesn’t show any pins either (across the globe). Still having difficulty pinning down consistent circumstances. If I get anything concrete, I’ll re-post with something – screenshots, code… something to chew on. Sorry for all the kvetching.
So, just a quick question Joshua – the sdk is not rendering any part of the mapView, it’s all google? The pins and map aren’t on different draw surfaces, being arranged top/bottom by the sdk, or anything like that - it’s 100% google?
Also, I note you say the pins are added after the map is reported loaded… If google never replies, or the reply is lost, it sounds like the pins never get added… If the map was draw, then it would appear there were no pins… Hmm. Can’t think of a way I could find out if that was the case.