External Storage Card on Android devices

3877
5
Jump to solution
06-04-2015 10:15 PM
PremRadhakrishnan
New Contributor III

Hello,

How do you reference TPKs or runtime content on external sdcards? Is there anything similar to System.userHomeFolder?

Thanks

Prem

PS: I am working on a Samsung Galaxy tab

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

System.userHomeFolder is cross platform, so you can use it on iOS and Android. By default on Android, this will return /sdcard as the user home path. See here - Deploy local offline data with your app—ArcGIS Runtime SDK for Qt | ArcGIS for Developers

I have found that if you have an actual external sdcard beyond what is shipped with the device, the actual name of the drive can change depending on the device (i.e. is not consistent between different Android devices). There isn't a generic function that will always return the external storage card path or anything, but you can go into whatever file explorer you have on your Android device and typically see the path there. You could then use Qt.platform.os to determine if it is Android and use that path, or something like that.

View solution in original post

0 Kudos
5 Replies
LucasDanzinger
Esri Frequent Contributor

System.userHomeFolder is cross platform, so you can use it on iOS and Android. By default on Android, this will return /sdcard as the user home path. See here - Deploy local offline data with your app—ArcGIS Runtime SDK for Qt | ArcGIS for Developers

I have found that if you have an actual external sdcard beyond what is shipped with the device, the actual name of the drive can change depending on the device (i.e. is not consistent between different Android devices). There isn't a generic function that will always return the external storage card path or anything, but you can go into whatever file explorer you have on your Android device and typically see the path there. You could then use Qt.platform.os to determine if it is Android and use that path, or something like that.

0 Kudos
PremRadhakrishnan
New Contributor III

UPDATE: This did not work, I had forgotten to clear some setting files and it was still pointing to the old SDcard directory so it looked like it worked.

I  went into my Files in my Android device and checked the info of my TPK

The path shows up as /storage/extSdCard/ArcGIS/Runtime .

I set this up and thought it worked but it did not.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hmm, one other thing to try is to add /mnt to the front of it ("/mnt/storage/extSdCard..."). From googling Qt android external storage, I see others sometimes needing to include /mnt in the path.

-Luke

0 Kudos
PremRadhakrishnan
New Contributor III

Found the issue, the TPKs work fine from the external cards but as soon as you try to put any geodatabases on the external card whether it be by placing them before installing the app or by trying to generate them on the sd card it seems like the app crashes.

I have the TPks on the external and geodatabases on the internal card and now the app is working.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Interesting, the geodatabase creates some temp files when it is opened, so I wonder if there are some permissions related issues that keep this from working.

0 Kudos