Write permission to a file in the internal storage

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Cairoo
Posts: 93
Joined: Wed Dec 05, 2012 5:54 pm

Write permission to a file in the internal storage

Post by Cairoo » Thu Mar 16, 2023 1:22 pm

Dear forum,

I have two LiveCode apps on the same android device.
The first app creates a file in the internal storage's Documents folder, like so:

Code: Select all

set the umask to "000"
put "Test1" into url ("binfile:/sdcard/Documents/testfile.txt")
I've tested the above and the file is created.

I need the second app to modify this file.
I tried to do the following in the second app, but the file is not modified:

Code: Select all

put "Modified" into url ("binfile:/sdcard/Documents/testfile.txt")
What can I do to enable my second app to modify the file?

- Gerrie

Klaus
Posts: 13380
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Write permission to a file in the internal storage

Post by Klaus » Thu Mar 16, 2023 1:33 pm

Hi Gerrie,

due to the strict security settings a.k.a. "Sandboxing" an app can only access files that have been created by that app.
We cannot access any data of another app!

Best

Klaus

Cairoo
Posts: 93
Joined: Wed Dec 05, 2012 5:54 pm

Re: Write permission to a file in the internal storage

Post by Cairoo » Thu Mar 16, 2023 2:26 pm

Thank you, Klaus

I understand the sandboxing concept and why it's necessary, but that is already provided for in each app's own per-application documents folder, i.e. specialFolderPath("documents").

I actually need my two apps to share a single sqlite database and both should be able to insert new data.

Klaus
Posts: 13380
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Write permission to a file in the internal storage

Post by Klaus » Thu Mar 16, 2023 2:35 pm

Cairoo wrote:
Thu Mar 16, 2023 2:26 pm
I understand the sandboxing concept and why it's necessary, but that is already provided for in each app's own per-application documents folder, i.e. specialFolderPath("documents").
That also applies to -> specialfolderpath("external documents")
Cairoo wrote:
Thu Mar 16, 2023 2:26 pm
I actually need my two apps to share a single sqlite database and both should be able to insert new data.
I understand that and would also like to do something like this, but I'm afraid this is just not possible.
Maybe someone will chime in and correct me if I'm wrong here.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6932
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Write permission to a file in the internal storage

Post by jacque » Thu Mar 16, 2023 6:30 pm

https://support.google.com/googleplay/a ... 7955?hl=en
Google has tightened its privacy policy and only apps which fall into certain categories can access the public file system. This applies to apps like file managers, photo editors, etc. If your app wants to use this permission you need to fill out a form, and it must be vetted by Google and approved.

Besides that, LC does not currently support any access to the public file system. There's a feature request in the QCC for it but given Google's new restrictions I suspect it's low priority.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”