No, but did you grant the permission to your app of read/write external storage?jacque wrote:Max, is your device rooted? I get nothing when querying either the files or the folders in mnt/sdcard.
'Importing' a data file into a Mobile app
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: 'Importing' a data file into a Mobile app
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: 'Importing' a data file into a Mobile app
The Android approach is different. You can't know if there is a SDCARD, so you just write to /mnt/sdcard. If the phone has the sdcard inserted, you are writing in the sdcard, else in a folder.SparkOut wrote:Thanks Max!
Now... is it possible to tell from LC whether the user's device is set to allow/prefer external storage?
You can just impose where to install your app using the standalone application settings.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: 'Importing' a data file into a Mobile app
Could you use the query:
If exists [file|folder|directory]
-in this situation to establish the presence of sdcard1 (assuming sdcard0 is the internal memory).
If exists [file|folder|directory]
-in this situation to establish the presence of sdcard1 (assuming sdcard0 is the internal memory).
Re: 'Importing' a data file into a Mobile app
It could exist /mnt/sdcard1 even without a sdcard. For example when you insert the sdcard, the sdcard is monunted in /mnt/sdcard1; but if you remove the sdcard, the director still exists.kurt wrote:Could you use the query:
If exists [file|folder|directory]
-in this situation to establish the presence of sdcard1 (assuming sdcard0 is the internal memory).
The mounting process is a function where you substitute the content of a folder with the content of a device. Unmounting a device, you just restore the previous state.
Android OS is a mess...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: 'Importing' a data file into a Mobile app
@MaxV, to be honest, I am confused a bit by the organization of the Android file system, the "emulated" shadow file system, etc. I probably should read up on it myself before I go making any further suggestions. That said....
some links:
http://android.stackexchange.com/questi ... ual-sdcard
https://source.android.com/devices/storage/index.html
The second link includes the following info:
...Starting in Android 4.4, the owner, group and modes of files on external storage devices are now synthesized based on directory structure. This enables apps to manage their package-specific directories on external storage without requiring they hold the broad WRITE_EXTERNAL_STORAGE permission. For example, the app with package name com.example.foo can now freely access Android/data/com.example.foo/ on external storage devices with no permissions....
So I would guess, assuming that you have already granted your app ext SD card access in whatever way you can in LC, and assuming you're writing for Android 4.4 and above, if you were to store your files in the precise location described above, it might work.
If you figure what works out in the context of LC, please let us know!
some links:
http://android.stackexchange.com/questi ... ual-sdcard
https://source.android.com/devices/storage/index.html
The second link includes the following info:
...Starting in Android 4.4, the owner, group and modes of files on external storage devices are now synthesized based on directory structure. This enables apps to manage their package-specific directories on external storage without requiring they hold the broad WRITE_EXTERNAL_STORAGE permission. For example, the app with package name com.example.foo can now freely access Android/data/com.example.foo/ on external storage devices with no permissions....
So I would guess, assuming that you have already granted your app ext SD card access in whatever way you can in LC, and assuming you're writing for Android 4.4 and above, if you were to store your files in the precise location described above, it might work.
If you figure what works out in the context of LC, please let us know!
Re: 'Importing' a data file into a Mobile app
Hi kurt,
the problem is that Android is bad copy of Linux, without linux programs but tons of horrible java. Who developed Android (Google) created a real mess without indicating how to manage with external sdcard and changing linux standards. So every phone producer has is way.
At the present most of phones has one internal sdcard that is /mnt/sdcard and one external sdcard that is /mnt/sdcard2.
You can decide where store your file (which directory), your idea to test directory existence is nice, but there is no way to have the 100% of security that if you write to /mnt/sdcard2, there is an external sdcard in the phone.
For example linux has the mtab file, that it tells you of all storage device/patition mounted on the pc, but on Android it doens't exist.
However Android programmers don't care of it, if you can write, that's ok; it's the user problem to find where real are the data using other apps.
the problem is that Android is bad copy of Linux, without linux programs but tons of horrible java. Who developed Android (Google) created a real mess without indicating how to manage with external sdcard and changing linux standards. So every phone producer has is way.
At the present most of phones has one internal sdcard that is /mnt/sdcard and one external sdcard that is /mnt/sdcard2.
You can decide where store your file (which directory), your idea to test directory existence is nice, but there is no way to have the 100% of security that if you write to /mnt/sdcard2, there is an external sdcard in the phone.
For example linux has the mtab file, that it tells you of all storage device/patition mounted on the pc, but on Android it doens't exist.

However Android programmers don't care of it, if you can write, that's ok; it's the user problem to find where real are the data using other apps.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w