Page 1 of 2
Saving a files on Android
Posted: Wed Mar 20, 2019 10:28 pm
by Pierre55
Hi,
I succeed to upload my application to my Android device (Galaxy Tab S2) but now I have another problem with the SAVING section of my script, when I want to save I don't have any way to choose the destination and the one the script propose is not working (/storage/emulated/0!), it give me an error "Error Locking /storage... in function FileRequest"
Thank you.
Re: Saving a files on Android
Posted: Fri Mar 22, 2019 9:10 pm
by airsoftsoftwair
On Android you may only write to certain folders. You can get those paths using
GetSystemInfo(). You can choose to write to "InternalStorage", "ExternalStorage", or "SDCard", e.g.
Code: Select all
StringToFile("Hello World", FullPath(GetSystemInfo().InternalStorage, "test.txt"))
Re: Saving a files on Android
Posted: Sat Mar 23, 2019 2:37 pm
by Pierre55
Thank you,
I need more info about this command..
I try;
t =
GetSystemInfo()
DebugPrint(t)
and I have this;
Table: 0x5a676ca8
It seems that this command can work only on Windows, MacOS, Linux, and for some fields Android?
I'm using AmigaOne XE.
Thank you.
Re: Saving a files on Android
Posted: Sat Mar 23, 2019 10:15 pm
by PEB
You need to specify the Table field that you want (such as: t.InternalStorage).
The following should work on your Amiga:
Code: Select all
t = GetSystemInfo()
DebugPrint(t.Preferences)
DebugPrint(t.TempFiles)
Re: Saving a files on Android
Posted: Sun Mar 24, 2019 12:20 pm
by airsoftsoftwair
Also note that if you want to write to the path returned in "SDCard" (see above), you need to ask for permission first by using
PermissionRequest().
Re: Saving a files on Android
Posted: Fri Apr 05, 2019 2:03 pm
by Pierre55
I run your script on a virtual Android (Bluestack)
StringToFile("Hello World", FullPath(
GetSystemInfo().InternalStorage, "test.txt"))
But there is no requester asking where I want to save the text file!
Thank you.
Re: Saving a files on Android
Posted: Sat Apr 06, 2019 11:25 am
by airsoftsoftwair
If you want a requester, you need to use
FileRequest() to obtain a path.
Re: Saving a files on Android
Posted: Sat Apr 06, 2019 3:13 pm
by Pierre55
Of course... How come I did not think to use
FileRequest() ?
Thank you.
Pierre
Re: Saving a files on Android
Posted: Mon Apr 08, 2019 1:26 pm
by Pierre55
Well even using
FileRequest() on android does nothing... there is no requester!
Anyone can validate that please.
Thank you.
Pierre
Re: Saving a files on Android
Posted: Wed Apr 10, 2019 10:13 pm
by airsoftsoftwair
Works here. Which Android version are you on?