ArcGIS android attachement adding

1058
6
06-16-2017 12:41 AM
PranavMS
New Contributor II

I am deveopping and android application with ArcGis android SDk. This is my first android application in this categorty. What i am doing here na.. I have some feature layers which is hosted in the ArcGIS online. I am showing those layers in my android application.And trying to access the features on the layer.

here i can add meand draw new polygon in the layer and it can sync with the online layer.

I am dividing my app two section as online and offline mapping.

I want to know how i can 
* Add the attachement online also in offline mode. 
* Edit the feature attribute in ofline.

for more references please see the link

ArcGIS android attachement adding - Stack Overflow  

0 Kudos
6 Replies
AlexanderNohe1
Occasional Contributor III

For adding the attachment:

(Untested) You should just be able to call the addAttachment method in the PopupAttachmentManager

PopupAttachmentManager| arcgis-android 

For updating the attributes, call getAttributes() and then update the features attributes.  Follow this with updateFeatureAsync()

Feature| arcgis-android 

I hope this helps!

PranavMS
New Contributor II

Alexander Nohe‌ thanks for your help but here i am using sdk version 10.2.9 only can you please share something for this SDK version.

0 Kudos
AlexanderNohe1
Occasional Contributor III

Well, considering this is your first app in this category, I would strongly suggest you use runtime version 100.  This version of the runtime will be receiving all future updates and will allow to new features that are coming to our platform like mobile map packages.

0 Kudos
HemingZhu
Occasional Contributor III

you could set offline editing as default (feature service pointing to your local cache); when finishing editing(add, update or delete), you could editing sync with online services. I found out this is the best approaches at for my cases. It simplify the code logic and feature editing working flow

PranavMS
New Contributor II

hzhu‌ thanks for your kind reply. Can you please share some code snippet for the #SDK version 10.2.9 ?

0 Kudos
HemingZhu
Occasional Contributor III

Pranav, it is hard to give a code snippet because my project was divided into modules. there is function how i setup the editable featurelayer, it pointed to local cached place.

private void setAssetLayer() {
    // add layers from the geodatabase
    Geodatabase geodatabase;
    try {
        geodatabase = new Geodatabase(AppResourceUtils.getLocalGDBPath());
        for (GeodatabaseFeatureTable gdbFeatureTable : geodatabase.getGeodatabaseTables()) {
            if (gdbFeatureTable.hasGeometry()) {
                if (gdbFeatureTable.getTableName().equals(AppResourceUtils.assetLayerName)) {
                    assetLayer = new FeatureLayer(gdbFeatureTable);
                    assetLayer.setName(AppResourceUtils.assetLayerName);
                    break;
                }
            }
        }
        if (assetLayer == null) {
            Warning_And_Quit("Assets Layer not found, App will exit");
        }

    } catch (FileNotFoundException e) {
        e.printStackTrace();
        Warning_And_Quit("Assets Layer found, App will exit");
    }
}
static String getLocalGDBPath(){
    return getApplicationPath()+AppName+"/localGDB/offline.geodatabase";
}
static String getApplicationPath(){
    return Environment.getExternalStorageDirectory().getPath() + DEFAULT_PATH;
}