Saving a files on Android

Please post anything related to the Hollywood APK Compiler here
Pierre55
Posts: 44
Joined: Sat Apr 01, 2017 4:25 pm

Saving a files on Android

Post by Pierre55 » Wed Mar 20, 2019 10:28 pm

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.

User avatar
airsoftsoftwair
Posts: 3162
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving a files on Android

Post by airsoftsoftwair » Fri Mar 22, 2019 9:10 pm

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"))

Pierre55
Posts: 44
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving a files on Android

Post by Pierre55 » Sat Mar 23, 2019 2:37 pm

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.

PEB
Posts: 255
Joined: Sun Feb 21, 2010 1:28 am

Re: Saving a files on Android

Post by PEB » Sat Mar 23, 2019 10:15 pm

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)

User avatar
airsoftsoftwair
Posts: 3162
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving a files on Android

Post by airsoftsoftwair » Sun Mar 24, 2019 12:20 pm

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().

Pierre55
Posts: 44
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving a files on Android

Post by Pierre55 » Fri Apr 05, 2019 2:03 pm

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.

User avatar
airsoftsoftwair
Posts: 3162
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving a files on Android

Post by airsoftsoftwair » Sat Apr 06, 2019 11:25 am

If you want a requester, you need to use FileRequest() to obtain a path.

Pierre55
Posts: 44
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving a files on Android

Post by Pierre55 » Sat Apr 06, 2019 3:13 pm

Of course... How come I did not think to use FileRequest() ?

Thank you.

Pierre

Pierre55
Posts: 44
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving a files on Android

Post by Pierre55 » Mon Apr 08, 2019 1:26 pm

Well even using FileRequest() on android does nothing... there is no requester!

Anyone can validate that please.

Thank you.

Pierre

User avatar
airsoftsoftwair
Posts: 3162
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Saving a files on Android

Post by airsoftsoftwair » Wed Apr 10, 2019 10:13 pm

Works here. Which Android version are you on?

Post Reply