Hi Anastasiia,
Currently the OfflineMapTask only supports taking a single map area offline for each download operation. If you want to take 2 distinct map areas offline, you would need to create 2 separate mobile map packages. In your code example above, I think you would need to change this line:
val downloadJob = offlineMapTask.downloadPreplannedOfflineMap(mapArea, directory)
to supply a different directory each time (I'm not an Android expert so I could be wrong). For example, you could append the map area's title onto the directory so you have one package called "Europe" and one called "Berlin" or similar.
However, if you need to be able to transition from the Europe wide scale to Berlin within a single map document that may not work for you. To achieve that, you could consider a workflow along these lines:
- Export a tile package for the Europe scale ahead of time using the "ExportTileCacheTask". Store the resulting .tpk on your device in a well known location.
- Download the preplanned map area for Berlin into your device as now.
- in Runtime code, when you come to load the map from the mobile map package, dynamically insert an ArcGISTiledLayer constructed from your Europe tpk into the map
Alternatively, depending on your data, you may be able to set up your webmap so that it contains data for both ranges.
I hope that helps,
Luke