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 or more 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.
#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.
To ask for multiple permissions at once, simply combine them using the bitwise Or operator.
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 for you so you
don't have to do that manually.
True
if user granted permission, False
if he declined themIf PermissionRequest(#PERMREQ_WRITEEXTERNAL) t = GetSystemInfo() StringToFile("Hello World", FullPath(t.SDCard, "test.txt")) Else NPrint("Sorry, no permission!") EndIfThe 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.