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: 107
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: 13806
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: 107
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: 13806
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: 7215
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

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

Re: Write permission to a file in the internal storage

Post by Klaus » Sun Apr 09, 2023 11:34 am

Find the report here and feel free to add some more comments:
https://quality.livecode.com/show_bug.cgi?id=23526

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Write permission to a file in the internal storage

Post by FourthWorld » Mon Apr 10, 2023 3:46 am

Do the two related apps need to be two separate apps? Could they be different views in one app?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
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 » Mon Apr 10, 2023 4:31 am

FourthWorld wrote:
Mon Apr 10, 2023 3:46 am
Do the two related apps need to be two separate apps? Could they be different views in one app?
We're looking for a way to import documents into an app. Currently we can't access any public-facing folders, which is where downloaded files automatically go. I'm not sure what you mean by a second app?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SteveB
Posts: 40
Joined: Mon Sep 30, 2019 4:49 pm

Re: Write permission to a file in the internal storage

Post by SteveB » Mon Apr 10, 2023 1:09 pm

Don't know if this will help your issue, but I did something similar a few years ago by using Dropbox to store an sql file.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Write permission to a file in the internal storage

Post by FourthWorld » Tue Apr 11, 2023 4:15 pm

jacque wrote:
Mon Apr 10, 2023 4:31 am
I'm not sure what you mean by a second app?
Described in the opening line of this thread.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Android Deployment”