Select to view content in your preferred language

Loading Tile Packages (TPK Files) in Arcgis Runtime SDK for Android 100.0

3617
2
Jump to solution
06-09-2017 05:09 AM
jonataspovoas
Regular Contributor

I've been creating an app for android using the Arcgis Runtime SDK for Android 100.0. In it, I have an activity that needs to create a ArcGISMap to add on my MapView, and this ArcGISMap need to load a series of Tile Packages (.TPK files) that are previously generated by the app user on another activity (I already got the later done).

I've been searching for the right way to do it, but so far the only kind of layer that seems to be compatible with using Tile Package Files is in the older version of the API (ArcGIS Runtime SDK for Android 10.2.9) .

In this article about how to use offline maps on the new API version, there's only info about creating Mobile Map Packages (.MMPK files) - witch don't seem to fullfil my client's need to select a number of areas that are require to access even without connectivity, createing a Geodatabase that I could sync - also doesn't seem to be effective, as all my client needs is tiles of imagery to serve as helping base to generate reports, and even how to create Tile Packages (the .TPK files in question), but no tips or info about how to actually use them at my app.

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Honored Contributor

I believe what you are really looking for is ad hoc offline mapping.  This allows users to generate an offline map from an existing web map.  We are all hoping that this is coming soon and are excited with the amount of work that the runtime team is putting into the next few releases.

As far as using a MMPK (mobile map package), this allows your users to create an all in one package that can be deployed to devices to be used in a totally offline environment.  As far as editing the data within the mobile map package on the device, I am not sure if this is possible.

Instead, what I suggest while the ad hoc offline mapping is still in development is that you pair the tilecache tool:

com.esri.arcgisruntime.tasks.tilecache| arcgis-android 

With the geodatabase package:

com.esri.arcgisruntime.tasks.geodatabase| arcgis-android 

With these two packages paired together, you should be able to generate a TPK to store on the device and a runtime geodatabase file with which you can sync services with.

I hope this helps!

View solution in original post

2 Replies
AlexanderNohe1
Honored Contributor

I believe what you are really looking for is ad hoc offline mapping.  This allows users to generate an offline map from an existing web map.  We are all hoping that this is coming soon and are excited with the amount of work that the runtime team is putting into the next few releases.

As far as using a MMPK (mobile map package), this allows your users to create an all in one package that can be deployed to devices to be used in a totally offline environment.  As far as editing the data within the mobile map package on the device, I am not sure if this is possible.

Instead, what I suggest while the ad hoc offline mapping is still in development is that you pair the tilecache tool:

com.esri.arcgisruntime.tasks.tilecache| arcgis-android 

With the geodatabase package:

com.esri.arcgisruntime.tasks.geodatabase| arcgis-android 

With these two packages paired together, you should be able to generate a TPK to store on the device and a runtime geodatabase file with which you can sync services with.

I hope this helps!

ShellyGill1
Esri Contributor

Just to add to Alexanders reply, you can add the TPK files as layers in a map by using ArcGISTiledLayer and TileCache. Create a TileCache by passing in the path to the TPK file, and then pass this to the constructor of the ArcGISTiled Layer, as shown here:

TileCache| arcgis-android 

For editing - correct that you cant really edit an MMPK (you could try by accessing the FeatureLayer methods, but you wouldnt be able to save or sync any changes) - as Alexander says, we're working on this workflow for an upcoming release. So if you need to develop something now - go ahead and use the existing tasks that Alexander linked to - you'll be able to update and simplify your code later on to use the new task - code will have a lot of similarities).

Hope this helps,

Shelly