AnsweredAssumed Answered

Add attachment to a feature using Xamarin Android

Question asked by Yifan_Liu-esristaff Employee on Aug 2, 2017
Latest reply on Aug 7, 2017 by Yifan_Liu-esristaff



I am adding an attachment to a feature on the feature service. My issue is I am able to add the attachment to the feature, but I am not sure how to push the attachment to the feature service. Here is what I did:

private async void save() {
    await feature.LoadAsync();
    // bytes is the byte array containing data of the file
    var result = await feature.AddAttachmentAsync(App._file.Name, @"image/", bytes);
    ServiceFeatureTable sft = feature.FeatureTable as ServiceFeatureTable;
    await sft.UpdateFeatureAsync(feature);
    await sft.ApplyEditsAsync();


Debugging shows that feature.AddAttachmentAsync() works as expected. After that line, I tried feature.GetAttachmentAsync() and it returns the just added attachment. However, I was not able to sync the attachment to the feature service. That feature service has attachment enabled.


Am I missing any steps here? Appreciate any help.