In the end we went with:
https://developers.arcgis.com/android
Here is sample code to get you started...
private Boolean setBaseLayer() {
File myShapeFilePath = null;
try {
if (MyApplication.mPathMaps == null || MyApplication.mPathMaps.length() < 1) {
File rootDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),
getApplication().getApplicationInfo().packageName);
File tmpDir = new File(rootDir, "maps");
MyApplication.mPathMaps = tmpDir.getAbsolutePath();
}
myShapeFilePath = new File(MyApplication.mPathMaps, BASE_LAYER_PATH);
if (!myShapeFilePath.exists()) {
displayFatalErrorMsg("Could not locate base map at:\n" + myShapeFilePath.getAbsolutePath());
return false;
}
ShapefileFeatureTable shapefileFeatureTable =
new ShapefileFeatureTable(myShapeFilePath.toString());
FeatureLayer featureLayer = new FeatureLayer(shapefileFeatureTable);
if (MyUVRvalues.getInstance().getBaseLayerColor().isEmpty()) {
displayFatalErrorMsg("Failed to get config value for 'GIS_BASE_LAYER'");
return false;
}
// int color = Color.argb(255, 84, 110, 122); // a = transparency 0 - 255
int color = Color.parseColor(MyUVRvalues.getInstance().getBaseLayerColor());
SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(color, SimpleFillSymbol.STYLE.SOLID);
SimpleRenderer simpleRenderer = new SimpleRenderer(simpleFillSymbol);
featureLayer.setRenderer(simpleRenderer);
featureLayer.setVisible(true);
mMapView.addLayer(featureLayer);
} catch (FileNotFoundException e) {
displayFatalErrorMsg("setBaseLayer() Failed, could not locate base map at:\n" + myShapeFilePath.getAbsolutePath()
+ "\n" + e.toString());
return false;
}
return true;
}
private Boolean setFeatureLayer(Boolean visible) {
File myShapeFilePath = null;
try {
myShapeFilePath = new File(MyApplication.mPathMaps, FEATURE_LAYER_PATH);
if (!myShapeFilePath.exists()) {
displayFatalErrorMsg("Could not locate feature map at:\n" + myShapeFilePath.getAbsolutePath());
return false;
}
ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(myShapeFilePath.toString());
mFeatureLayer = new FeatureLayer(shapefileFeatureTable);
mFeatureLayer.setRenderer(getUniqueValueRenderer());
mFeatureLayer.setSelectionColorWidth(7); // integer in DP(density independent pixels).
mFeatureLayer.setSelectionColor(Color.YELLOW);
mFeatureLayer.setVisible(visible); //Only show when zoomed in
mMapView.addLayer(mFeatureLayer);
} catch (FileNotFoundException e) {
displayFatalErrorMsg("Could not locate feature map at:\n" + myShapeFilePath.getAbsolutePath());
return false;
} catch (Exception e) {
displayFatalErrorMsg("setFeatureLayer() caused exception:\n" + e.toString());
return false;
}
return true;
}
private UniqueValueRenderer getUniqueValueRenderer() throws Exception {
// UniqueValueRenderer used to assign unique values to feature
UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
// setting the field for the unique values
uniqueValueRenderer.setField1(MyUVRvalues.getInstance().getFieldName());
// Rendering Type which is used to fill the region
SimpleFillSymbol defaultsymbol =
new SimpleFillSymbol(Color.parseColor(MyUVRvalues.getInstance().getDefaultColor()));
uniqueValueRenderer.setDefaultSymbol(defaultsymbol);
for (UVRFields field : MyUVRvalues.getInstance().getUVRFields()) {
UniqueValue uv = new UniqueValue();
String[] uniqueAttribute = {field.getValue()};
uv.setValue(uniqueAttribute);
// The symbol definition for each region
uv.setSymbol(new SimpleFillSymbol(Color.parseColor(field.getColor())));
uniqueValueRenderer.addUniqueValue(uv);
}
return uniqueValueRenderer;
}