Hi Team,
I am trying to download a mmpk file to my device and then display it. Map size is 93MB.
When i try to call
val portalItemData = portalItem.fetchData()
it throws an exception,
Failed to allocate a 97621424 byte allocation with 25149440 free bytes and 89MB until OOM, target footprint 132745784, growth limit 201326592
If try the sample map download example, its size is 6.4MB. I am able to download it.
Is there any workaround for this?
I have referred to the sample example in arcGIS to tryout the code.
https://developers.arcgis.com/kotlin/sample-code/display-map-from-mobile-map-package/
The portal item fetchData property is not ideal for large file downloads as it downloads data to the device's memory. I would recommend using the portal item data endpoint to perform a download and handling the download service as part of your code:
{portalURL}/sharing/rest/content/items/{itemIdentifier}/data
We plan to release a helper function as part of the Kotlin Maps SDK that would utilize the data endpoint which would be suitable for file downloads of any size mostly for the next 200.x release.
Hi @Shubham_Sharma ,
I have tried this URL, just need your confirmation on it.
https://www.arcgis.com/sharing/rest/content/items/<itemId>/data?token=<Auth-Token>
Is that API structured is correct?
Hi Team,
I tried but it throws me a invalid token though its the same auth token I got it when i logged in.
https://www.arcgis.com/sharing/rest/content/items/9f138b1072db4dc793bef409d843567c/data?f=json&token=<auth_token>
[text={"error":{"code":498,"message":"Invalid token.","details":[]}}]
Let me know if i am missing anything
I'm afraid that if your portal item is secured, it won't be trivial to handle the authentication part (passing the correct token) with your own download implementation. We are going to provide a `ArcGISHttpClient.download()` function as part of our upcoming 200.2.0 release which will handle the authentication part for you. Until then, would you be able to download non-secured (public) portal item data?