Downloaded map list not showing when open the application again
tashi146 opened this issue · comments
#Downloaded map list not showing in list.
Issue
I have tried to running the example application for download-preplanned-map-area
and it is running fine. I am able to download map and display the downloaded map in downloaded list as well.
But when I close the app and try running again. downloaded map are not listing in downloaded list.
Question
I can see how we are downloading map with DownloadPreplannedOfflineMapJob
and load the result. But How can we load the map which is already downloaded in cache folder?
I am expeting code something similar like this:
ArcGISMap offline = ArcGISMap.createFromInternal("")
But I can't get the proper field and parameter.
In Screenshot below you can see city hall, and village green are downloaded and download button are disabled as well but not listing in downloaded list when I close and run the application.
https://github.com/Esri/arcgis-runtime-samples-android/tree/main/java/download-preplanned-map-area
Hi Tashi!
We save the map to the cache in the sample only because we expect people to run it more than once and we need it to effectively be "reset" by the time they run it again.
Instead of saving the map to the cache, save it to the app's scoped storage with getExternalFilesDir(null)
instead of cacheDir
Hi @TADraeseke,
Thanks for quick respond. I am saving map in file path only instead of cache. And also I can see the downloaded map in folder.
But when I close and run application again. Downloaded map are not listing in downloaded listview. And I know It is because there is no logic in code to display map list from local path.
Question
So the answer I really need is how can I load map from local file once downloaded?. There is no logic for loading map from file path in the sample app
Here is the snippet
I am trying to load City Hall Area from local path
Hi @tashi146 -- sorry I'm with you now...
So what's being created from the DownloadPreplannedOfflineMapJob
is a MobileMapPackage
(.mmpk). In our API a mobile map package on disk can either be mymap.mmpk
(if it's zipped) or in an exploded state it's a folder. For yours it's City Hall Area
which contains a p13
folder and so on. This is a mobile map package too! So...
You can create a MobileMapPackage(getExternalFilesDir(null)?.path + "/City Hall Area"
(I don't recall the syntax it might need to be City_Hall_Area) and then set the first map from the mobile map package to mapView.map
.
Alternatively if you're in the same app that's run the DownloadPreplannedOfflineMapJob
you can access the mobile map package at this line by replacing downloadPreplannedOfflineMapResult.offlineMap
with downloadPreplannedOfflineMapResult.mobileMapPackage
This should get you where you need to be :)
I'd really like to know how good (or bad!) our samples are at supporting our users--what are we getting right? what are we getting wrong? Any chance you'd be interested in a short email or call with me to help me improve our offering by understanding how you're using this stuff? Please drop me an email if so! TDraeseke@esri.com
@TADraeseke Ah, I see. It is working fine now. I will let you know how we are using this. Thanks for the awesome help.