ok = PermissionRequest(perms)
PermissionRequest() will return False, otherwise
True will be returned.
The permissions you want to request have to be passed in the perms argument. This
can be set to one of the following permission flags:
#PERMREQ_READEXTERNAL:SDCard
item in the table returned by GetSystemInfo(). By default,
Android apps are not allowed to read from the external storage device. Note that
this flag is only supported on Android versions older than version 11. If you
need access to the external storage on Android 11 and up, you should use the
new #PERMREQ_MANAGEEXTERNAL flag instead (see below).
#PERMREQ_WRITEEXTERNAL:SDCard
item in the table returned by GetSystemInfo(). By default,
Android apps are not allowed to write to the external storage device. Note that
#PERMREQ_WRITEEXTERNAL implies #PERMREQ_READEXTERNAL so you don't have to set
#PERMREQ_READEXTERNAL when using this flag. Also note that this flag is only supported
on Android versions older than version 11. If you need access to the external storage
on Android 11 and up, you should use the new #PERMREQ_MANAGEEXTERNAL flag instead
(see below).
#PERMREQ_MANAGEEXTERNAL:SDCard
item in the table returned by GetSystemInfo(). By default,
Android apps are not allowed to write to the external storage device. This is the
recommended way to ask for full read/write permission on the external storage device
for all systems running Android 11 and higher. Keep in mind that due to security concerns
Google imposes severe restrictions for apps requiring full access to the external storage
device so if your app requests this permission, it might not be allowed on the Play Store.
If you intend to publish your app on the Play Store, it's recommended to use Android's
Storage Access Framework (SAF) or MediaStore instead of requesting the #PERMREQ_MANAGEEXTERNAL
permission. See Working with Android URIs for details. (V11.0)
Note that this function is only needed when compiling stand-alone APKs using the
Hollywood APK Compiler. When using the Hollywood Player, the Hollywood Player
will automatically request the #PERMREQ_WRITEEXTERNAL permission (on pre-Android 11
systems) or the #PERMREQ_MANAGEEXTERNAL (on Android 11 and higher) for you so you
don't have to do that manually and your applets will automatically be able to
access the external storage.
True if user granted permission, False if he declined them
If PermissionRequest(#PERMREQ_WRITEEXTERNAL)
t = GetSystemInfo()
StringToFile("Hello World", FullPath(t.SDCard, "test.txt"))
Else
NPrint("Sorry, no permission!")
EndIf
The code above tries to get a permission from the user to write to the external
storage device. If the user grants this permission, the code will write a file
named test.txt to the external storage device.