It seems that all of the map objects that can be used to download a map are constructed using PortalItems in the Create an offline map guide. Is there a way to download a map to view offline using the Services pattern that is from a hosted feature service? Am I misreading the fact that you can allow feature service data to be downloaded, edited, and changes synchronized?
Also, when you view the map you have dowloaded offline, can you still enable popups to display the attributes of the features?
Hi Cora,
You can create an offline layer from a feature service, by using the GeodatabaseSyncTask. You can download features to a local geodatabase, then add a layer to a map based on these features. You can then make edits, and sync changes. Its slightly different to what we'd call an 'offline map' because it's only the features you're taking offline in this case, not the whole 'map'. Hopefully this help topic should give you the info you need on this workflow - Create an offline layer—ArcGIS Runtime SDK for Android | ArcGIS for Developers . The downloaded features have their attribute values, so you can still set up pop-ups, for both offline layers, and offline maps, as far as I know. Note that in the task parameters you can specify if feature attachments are included in the offline data.
Hope this helps,
Shelly
Thank you so much for your responses to my questions! I am implementing that sample code for creating an offline layer now but am running into some issues with getting the default parameters for generating the geodatabase. Android Studio throws an error that there is an Invalid response around this chunk of code (createOfflineData() is declared last in the onCreate() method for this class (OfflineActivity.java):
private static void createOfflineData() { // create a new GeodatabaseSyncTask to create a local version of feature service data String featureServiceUrl = "https://services8.arcgis.com/UT5WPtsyyxzDrV2P/ArcGIS/rest/services/GNP_Fields/FeatureServer"; final GeodatabaseSyncTask gdbSyncTask = new GeodatabaseSyncTask(featureServiceUrl); // define an extent for the features to include Envelope extent = aMapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry().getExtent(); // get the default parameters for generating a geodatabase ListenableFuture<GenerateGeodatabaseParameters> generateGdbParamsFuture = gdbSyncTask.createDefaultGenerateGeodatabaseParametersAsync(extent); generateGdbParamsFuture.addDoneListener(() -> { try { GenerateGeodatabaseParameters generateGdbParams = generateGdbParamsFuture.get(); // set the sync model to per layer *********OfflineActivity.java:89 is here******** generateGdbParams.setSyncModel(SyncModel.PER_LAYER); . . . W/System.err: java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid response W/System.err: at com.esri.arcgisruntime.internal.a.b.get(SourceFile:128) W/System.err: at com.example.corac.gnp_labels.OfflineActivity.lambda$createOfflineData$2$OfflineActivity(OfflineActivity.java:89)