Reducing load time of offline mbtiles layer in Mapbox Android SDK -
i have basic android app loads , displays local .mbtiles file using mapbox sdk (version 0.7.3) there significant delay when first loading app (resulting in black screen) while loads tiles. looks might loading of tiles (not visible tiles @ launch). there way change this. .mbtiles file approximately 257 mb in size , takes approximately 40 seconds app display map after starting.
any appreciated.
here tiles loaded:
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); this.findviewbyid(r.id.mapview); mapview mapview = (mapview) findviewbyid(r.id.mapview); mapview.setzoom(9); mapview.setminzoomlevel(8); mapview.setmaxzoomlevel(15); mapview.setcenter(new latlng(55.676111, 12.568333)); mapview.settilesource(new mbtileslayer(this, "dk_underlay_1_0_4.mbtiles")); }
and here logs showing ~40 second gap when loading app:
04-29 11:07:54.173 23590-23590/com.example.stugrey.testapp d/mapboxmapview﹕ centerlatlng not specified in xml. 04-29 11:07:54.173 23590-23590/com.example.stugrey.testapp d/mapbox mapview﹕ zoomlevel not specified in xml. 04-29 11:08:34.236 23590-23590/com.example.stugrey.testapp d/apputils﹕ device density 320, , result of @2x check true 04-29 11:08:34.236 23590-23590/com.example.stugrey.testapp d/maptiledownloader﹕ going use @2x tiles? 'true' 04-29 11:08:34.308 23590-23590/com.example.stugrey.testapp i/adreno-egl﹕ <qegldrvapi_eglinitialize:410>: egl 1.4 qualcomm build: au_linux_android_lnx.la.3.5.1_rb1.04.04.02.048.018_msm8226_lnx.la.3.5.1_rb1__release_au () opengl es shader compiler version: e031.24.00.08 build date: 03/07/14 fri local branch: remote branch: quic/lnx.la.3.5.1_rb1.1 local patches: none reconstruct branch: au_linux_android_lnx.la.3.5.1_rb1.04.04.02.048.018 + f2fd134 + nothing
the slow part of code creation of mbtileslayer
. else should smooth. 1 thing move slow new mbtileslayer(this, "dk_underlay_1_0_4.mbtiles")
code asynctask
ui not blocked during slow loading. not reduce load time ensures non blocked ui.
so show progress indicator (or placeholder) instead of black screen.
Comments
Post a Comment