Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG REPORT] RequestPermission( "WriteExternal" ) Fail on Android 10

Author
Message
BITBITBIT
3
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 25th Jul 2020 16:49 Edited at: 25th Jul 2020 23:57
Hello everybody. I wish to report a possible bug regarding permissions on latest Android 10 ( Samsung Galaxy S10e ), tested using AppGameKit Classic.

I have noticed that if we asked for permission to 'Write External' using RequestPermission( "WriteExternal" ) , the permission seems to be granted, but any attempt to write files to 'document' path will be rejected, as if the app wasn't granted permission yet.
Even if we checked the permission first using CheckPermission( "WriteExternal" ) = 2 , and confirmed the permission to be granted, the write will still fail and crash the program, returning an errror:
"Error: Failed to create folder "emulated" in path "/storage/emulated/0/testsavedata/testarray.json", the app may not have permission to create in main.agc at line 36 "
As you can see, it's almost as if the app is trying to create a folder named "emulated' inside the final file name (testarray.json), and fail.

However, this bug does not seems to occur in older Android versions. The external file and folders was successfully created in older Android version.

Please test the bug on Android 10, to see if it occurs in other Android smartphone running the same Android version. I have only tested it on one smartphone with Android 10.
Thank you for your attention. I hope this can be fixed.
Example project file included:

Attachments

Login to view attachments
SFSW
18
Years of Service
Recently Online
Joined: 9th Oct 2002
Location:
Posted: 25th Jul 2020 20:31 Edited at: 25th Jul 2020 20:32
This is a result of changes Google made in Android 10 and up. See this thread for details and a work-around: https://forum.thegamecreators.com/thread/226631
BITBITBIT
3
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 25th Jul 2020 23:54
Thank you very much SFSW for the heads up.

Though I'm facing the exact same problem as SAR1. The SharedData folder is just isn't there. Will try again.

Just to add, even if the app is using all the valid AppID, and installed via Google Play or via apk, the bug is still there.

I'm using 'save array' command to save backup save data, that the game will check if default save data isn't found in local default app read/write location/corrupted. The save data contains useful but not critical datas which I would rather not store on the game server. But it seems like now there is no reliable way to access outside folders.
Furord
6
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 8th Aug 2020 11:51 Edited at: 8th Aug 2020 11:54
Hi BITBITBIT, I use AppBameKit Studio and the same thing happens, I have tested it with android 5.1 / 6/9/10 and it does not work in any after compiled, before compiling it using AppGameKit Player it works in some. I used the "SetRawWritePath" command and it worked fine, now they have removed it and the alternative "Directory Raw" commands don't work once the program is compiled.
The error it gives is the same, the address does not exist or does not have permissions, as the address does exist, I guess it is a permission problem.
fubarpk
Retired Moderator
15
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 8th Aug 2020 15:40
snippet from the help

ChooseRawFile
Description
Presents the user with an option to choose a file stored on their current platform (Windows/Mac only), for example a photo or sound file. If the user cancels the operation an empty string will be returned, otherwise the file will be copied to the apps current directory and the filename returned so that it can be used by your app.

You may specify an optional extension filter to limit the types of files the user will see when browsing. For example using an extension filter of "*.wav" would limit the user to choosing .wav files. For multiple extensions separate them with a semicolon like so "*.wav;*.mp3;*.png".

If using this command is used in tier 2 the returned string must be deleted when you are finished with it, even if it is an empty string. A null string will not be returned. If you set returnFullPath to 1 then the file will not be copied to the write folder, instead the full path will be returned to you and you can load it using the "raw:" prefix with the normal file commands.

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2020-10-22 02:20:10
Your offset time is: 2020-10-22 02:20:10