cancel
Showing results for 
Search instead for 
Did you mean: 

oData SDK Android - download media link via /$value

0 Kudos

Hello,

   I am creating the native Android app that is using oData and connects to NW Gateway or SMP 3.0 for data provisioning. Following how-to guides for android from Claudia Pacheco    I managed well along the way to connect to SMP, get some entities back and parse data.

   However one of my requirements is to download the binary attachment that are modeled as mediaLink in NW gateway and are accessible over urls like Document('ID00001')/$value

When I try to put a code like one below system fails with message that I have wrong conversation


OnlineODataStore store = openListener.getStore();

ODataResponseSingle resp = store.executeReadEntity("Document('ID00001')/$value", null);

When I look at logs in SMP server or testing the URL in Gateway I see that file content is sent to mobile device and apparently it fails at parsing it inside ODataResponseSingle handler also, when I test the same URL from browser pointing directly to NW Gateway I can get the file downloaded without any problems.


Can someone point me in right direction on how to download media content properly to mobile devices as I am a bit stuck there at the moment?


Best regards, Artem

Accepted Solutions (1)

Accepted Solutions (1)

claudiapacheco
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Artem,

Could you try using this method?

store.executeReadPropertyRaw(<resourcepath>,<options>)

where resourcePath  is the resource path of the raw value of a property to be read

More information about this method can be found here  http://help.sap.com/saphelp_smp305sdk/helpdata/en/83/3d99c280d71014b270ceb0b562eaea/content.htm

Let me know,

Best regards

Claudia

0 Kudos

Hello Claudia,   

    thank you for your response. Unfortunately store.executeReadPropertyRaw fails with the same error

    There is very little documentation on API on how to use it properly but so far I did not managed to get any forther on it.

Best regards, Artem

claudiapacheco
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Artem,

I checked with other colleagues and it seems this is a bug. Development is now aware of the issue, but I think it will be better for you to open a ticket to directly follow up in the progress.

Best regards

Claudia

0 Kudos

Hello Claudia,

Thank you for following up on it.

Yes, I will do the ticket for it.

For those who run in the same issue - it looks like processing code in Android side some how changes as stream so usual processing is not possible. As workaround we catch the stream in ResponseFilter where the stream is still OK - we take it from there.

Best regards, Artem

Answers (0)