Hi,
I’ve been working with the android SDK since a couple of weeks now and I experience a lot of random crashes while the map is drawn.
Regardless if the content is OSM or a shape or a tiff, at some point the app crash while refreshing with an exception in Mapsuite.androidedition.LayerTile.View.Drawcore.
few words on my project, I’ve one backgroundoverlay with osm or a shape, or a tif.
and a foregroundoverlay that contains an inmemorylayer, which contains 1 vehicle (a pointshape)
The vehicle is moving, so I’m updating the foregroundoverlay every seconds
it takes 10 to 15 refresh to get the background overlay refresh to crash.
thank you for your help
Patrick.
Random app crash
Hi Patrick,
I guess It’s a known issue that causes
by android Bitmap memory strategy. We are only allowed to use fixed memory
size(8MB,16MB,.. according to the different devices) for one app.
Here are some links for the android memory strategy:
stackoverflow.com/questions/...ult-limits
stackoverflow.com/questions/...-exception
I also guess you maybe using the multi-thread(by default in android edition).
In that case, when we refresh map frequently, the GC will too busy to
collect those bitmaps and lead this OOM exception which makes the app crash.
As a temporary workaround, we can try to use SingleTile, and it works well
without any exceptions in our end. Please try this temporarily, and we will keep
researching to figure out a better solution. I also attached a test sample under single thread based on your case, please check it.
If the issue persist, please feel free to let us know.
Thanks,
Troy
SingTileRefreshTest.zip (14 KB)
Troy,
your sample solves a lot of issues, thank you.
However, you can make it crash just by zooming in a couple of times …
is there a max zoom to apply to OSM ?
if yes => how ?
thank you
Patrick.
Troy,
another big issue with your sample : you moved from OpenStreetMapOverlay to OpenStreetMapTileOverlay which is drawn much more faster !!
but, when I project my GPS position on the map, the point is about 50km from here (while it’s correct in OpenStreetMapOverlay).
Please advise.
Patrick.
Hi Patrick,
Thanks for reporting the issues, for both of the new two issues are proved bugs and we have fixed them, we have shared the latest modification dll from ap.thinkgeo.com:5001/fbsharing/meGulGc2 ,please try it and feel free to let us know if the issue persists.
For the max zoom of OSM, this is defined by OSM server and the max zoom is 19, more details please refer to wiki.openstreetmap.org/wiki/Zoom_levels
Btw, in my last sample, sorry to say there was a mistake that we need to reset the map’s ZoomLevelset each time, when we change the map unit, like:
mapView.MapUnit = GeographyUnit.Meter;
mapView.ZoomLevelSet = new GoogleMapsZoomLevelSet();
Thanks,
Troy
Troy,
the very first try seems much more robust, thx very much.
There is a breaking change: androidMap.ZoomMapTool.Visibility is no longer defined … what is the new api for hiding these buttons ?
Regards,
Patrick.
after 1h of testing, OSM is really much more robust.
there is still a crash if you turn the mobile from portrait to landscape with that options: [Activity(ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
However, this version does not work anymore with tiff as large rasters require multitiles option.
setting multitile option raises a null pointer exception at the first map.refresh.
Hi Patrick,
For the Visibility Api, we did do a breaking change and changed to IsEnabled property.
For the #2 issue about the crash, sorry to say we didn’t recreate it in several devices and simulator with that options. Does it only happen in that options? or can also happen with default options? In general, the crash is always related with memory leak, so would you please let us know how you test?
As for the # 3, we tested a tiff layer with about 200m size with multi-tile, but also didn’t get the exception, is it convenience to send us your sample with the data in your client ftp? (if no a ftp, please contact with support@thinkgeo.com and they will setup a new one for you).
Thanks,
Troy
Thank you for the breaking change info.
for #2: issue while going from portrait to landscape.
I attach a solution that reproduce the isse.
I’m testing on a galaxy s3 physical device, just launch the application and move 5 times from portrait to landscape.
for #3: I’ll try to reproduce and open a new discussion as it’s limited to large .tif.
thank you for your help.
Patrick.
002_001_Temp.zip (13.7 KB)
Hi Patrick,
Okay, thanks for your sample and we’ll have a test on it. But since our best man for Android Edition is in holiday for a few days, I am afraid we need more days on this issue. Then I will give the reply ASAP.
As for the #3, since our forums limits only 2m size file, so please contact our support@thinkgeo.com and they’ll setup a ftp account for you.
Thanks,
Troy
Hi Patric,
For #3, I grab it in another thread, so, let’s skip it from here.
thinkgeo.com/forums/MapSuite/tabid/143/aft/12264/Default.aspx
Thanks,
Troy