IS there any Sample app or doc to perform searching on mmpk file in Android App?

1415
4
02-14-2017 10:02 PM
KamalAgarwal
New Contributor II

Hi ,

I want to perform searching in my Native Android app on mmpk file which i load locally from device external storage ,so please let me know if there is any doc or sample exist regarding this 

thanks

0 Kudos
4 Replies
ShellyGill1
Esri Contributor

Hi - MMPK files can contain operational layers that are made of features. So if you've loaded your MMPK and one of the ArcGISMaps it contains, then you should be able to do your search. If there's a specific layer you want to search on, using a specific query such as 'attribute=someValue', then first get the feature layer you want to search on in the OperationalLayers collection of the ArcGISMap. Then get the FeatureTable from the FeatureLayer, and then call queryFeaturesAsync, as shown in this sample - Feature layer query—ArcGIS Runtime SDK for Android | ArcGIS for Developers .

Alternatively, if you want to search by allowing a user to tap on a MapView at a location and search for features in the ArcGISMap at that location, which might be in any layer in the map, you can use the identify methods. I don't think we yet have a sample for that, but it's described with a number of code snippets in the Guide topic Identify Features - for example you can identify against all features in all of the current feature layers in the map as shown in this section - Identify features—ArcGIS Runtime SDK for Android | ArcGIS for Developers .

Hope this helps,

Shelly

0 Kudos
MarcusSilva
New Contributor

Hi Shelly,

I've tried to follow your orientation but a I got stuck when trying to get the feature table from the feature layer. Could not find a getFeatureTable or getTable method from the layer I got from getOperationalLayers.get(2), which is the layer I'm trying to access. Once I'm getting started with the API and mmpk, I ask you: is there anything I should do when I create de mmpk to get access to feature table or when  I load it into the application?

Thanks in advance

Marcus

0 Kudos
ShellyGill1
Esri Contributor

Hi Marcus,

The LayerList you get back from getOperationalLayers contains all sorts of layers, so it uses the high-level Layer class. Try casting to FeatureLayer - that class exposes the getFeatureTable method - FeatureLayer| arcgis-android . e.g. 

for (Layer layer : mMapView.getMap().getOperationalLayers()) {
  if (layer instanceof FeatureLayer) {
    FeatureLayer featureLayer = (FeatureLayer) layer;
    FeatureTable featureTable = featureLayer.getFeatureTable();
    // use FeatureTable...
    
  }

Hope this helps,

Shelly

0 Kudos
MarcusSilva
New Contributor

Thanks for your reply Shelly, I’ll take a look at that.

Regards,

Marcus

0 Kudos