Google maps crash and memory use - android

Google maps native plugin ionic 3
Sometimes during normal google maps operations like adding markers in loop or clearing map, there is an application crash. There is no patter for the crash. And the error message is as one bellow:
java.lang.NegativeArraySizeException: -1
at plugin.google.maps.PluginMarker$3.run(PluginMarker.java:149)
Could someone tell me what does it mean, cause I think that it is connected with google maps native plugin error.
Sometimes it breaks during normal map use, sometimes in other part of application when map is forced to clear and move camera.
This error only happens on page where I have to do a lot of work on map.
In other pages there is no problem. When I want to make this error again it does not come up.
My second problem is that when user plays with map a lot the size of data in memory grows up. What might be the way to clear it? I know that when I use
this.map.setVisible(false);
it saves map state in the background and only hides map.

I have already found a solution to first problem. I came up with idea that markerCluster is the best solution, cause app crash might have been connected with markers overloading map during adding markers. MarkerCluster only loads few markers which are referencing others (Google Maps Native plugin).

Related

Android Google Maps - Update custom Tiles (TileProvider) without flickering (weather maps)

I'm using Google maps in my app with custom tiles (weather images - radar) above the maps.
Now I want to do some animation with that tiles. So the user can change the time and it will show tiles for that time. With changing time (on SeekBar) it will change the tiles and you can see the movement of the clouds/storm... (like in other weather apps).
But I have a problem with flickering the images during changing the Tiles. (I tested some other weather apps with Google maps and it should somehow work).
I tried several things:
TileOverlayOptions.setFadeIn(false)
TileOverlay.clearTileCache()
Storing Tiles in memory in HashMap
And some other options but nothing works correctly
I also find this How to update TileOverlay without a flicker? but there is not any solution. Maybe try to use more TileOverlays but I'm not sure if this will work.
Do you have some suggestions or tips on how to solve this?
Thanks for any advice.

SnapRoads - how to?

I've implemented a Google Location Api on my app to track my routes. I record my coordinates in a sqlite Db and then save these coordinates as a GPX file to see on map parsing and build via polylines.
There are a lot of points.
I see that unfortunately the position not seems follows the road even if I drive/walk in the middle of it.
Searching with google I've founded SnapToRoads as part of Google map API but, unfortunately not for Android, even if it seems that is possible to implements (but I don't know in which manner).
I wonder if someone knows how to solve this problem or some workarounds
At the end, I implemented SnapToRoad API to solve this problem, even if I have to use my key on source code (if I don't want implement a web site with Javascript)

Adding Makers To Google Maps V3 When No Data Connection

I am in a situation where, even if there are no maps being displayed due to no connection (the screen is just blank with not features available), I still want to add the markers and polylines onto the Google Map.
Is this possible?
It seems that if there is no data and no maps have been loaded that nothing is displayed?
THANKS IN ADVANCE
This issue is described here: http://code.google.com/p/gmaps-api-issues/issues/detail?id=5017
There seems to be a workaround of not using ACCESS_NETWORK_STATE.
They will probably fix it completly in the next release.

Multiple maps v2 in TabActivity

I'm currently trying to have 2 maps v2 in different tabs of a TabActivity using MapView objects. The problem arises in the following scenario:
tab1 with a map is displayed
go to tab2 in order to display another map
in this second tab looks like the map image from first tab is overlapping the new map. See the following picture:
On the right you can see how the first map is still displayed on top of it. The touch events are going to the new map but that doesn't really help. I spent a lot of time trying to convert our app to use fragments and run into other types of issues. One of them being http://code.google.com/p/android/issues/detail?id=40035 so that's not a good option either.
So far I haven't been able to find any workaround. To easily try various changes I wrote a simple application and made it available here: https://github.com/cristizmf/TestMapsV2. It needs only the right location for maps library project and a good maps key in manifest.
Any ideas would be greatly appreciated.
Later edit: I've logged an issue for this: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5027&thanks=5027&ts=1362071369
We are having the exact same problem. I suspect this is caused by the fact that the new maps uses OpenGL - possibly android cant deal with having two OpenGL widgets in the view hierarchy at the same time even though one is hidden.
The only way we worked around this was to actually remove the mapview when leaving a tab, then construct a new one and add it back in when going back into the tab. This ensures that there are never two maps constructed at once.
Nasty, but it worked.
I ran into the same issue a few days ago and was pulling my hair out over what to do.
Originally I had my app set up with "Tabs the Fragment way" as seen here to avoid the deprecated TabActivity, and used this hack to allow me to incorporate Maps v1 in with the Fragments. It basically just masks an Activity as a Fragment.
But then switched to TabActivity further down the track for simplicity / it was better suited for the whole app.
But now obviously this 2x Maps v2 fragment problem has become an issue..
So I have reverted back to "Tabs with Fragments" and just have the "hack setup" as mentioned above for each tab, which allows to have an Activity for each tab, AND having more than one Maps v2 displaying for each Tab. I haven't gone into too much depth with it, but it seems to be doing the job atm, with having just thrown some code together to test it out..
Don't know if you're still having an issue with this / this obviously isn't the most correct solution, but just thought I'd share my two cents incase you still needed it.
Cheers.

Android Google Maps Maritime charts layers

I'm looking at displaying a map within my Android app that presents maritime charts, and also needs to work offline as there will be no network connectivity of any type available. I suspect that I will get my maritime charts supplied as a series of bitmap files with LAT/LON references of the area clipped.
My question is this - how do I go about implementing this ? I guess I have to add them as a layer somehow, can someone show me how to do this ?
Also, as the device will be offline, will there be a problem trying to use Google maps even if all the content is held locally, will the API just "not work" until it has connectivity ?
Thanks in advance.
As this just earned Tumbleweed, I thought I should update it.
I tried really hard to use the Maps API offline, with my bitmap as a layer - it didn't work out. The API is too reliant on the interweb and just seems to timeout when trying just about anything.
Simple solution, I have just extended the ImageView class to display my bitmap chart & overlays.

Categories

Resources