AndroidPermission - stingray.AndroidPermission namespace reference - Stingray Lua API Reference

stingray.AndroidPermission namespace reference

Description

Use this API to check and request permission to access system resources and data on Android platforms.

The available permissions are described on this page in the Android documentation, in the table at the bottom of the page.

When you call these functions, identify permissions by passing stingray.AndroidPermission.<PERMISSION_NAME>, where <PERMISSION_NAME> matches one of the values in the Permissions column of the table at the link above. For example:

local can_read = stingray.AndroidPermission.check( stingray.AndroidPermission.READ_EXTERNAL_STORAGE )
local can_write = stingray.AndroidPermission.check( stingray.AndroidPermission.WRITE_EXTERNAL_STORAGE )

Functions

Parameters

permission :

string

The permission to query (e.g., stingray.AndroidPermission.READ_EXTERNAL_STORAGE, stingray.AndroidPermission.CAMERA, etc. These are equivalent to the android.Manifest.AndroidPermission - https://developer.android.com/reference/android/Manifest.permission.html)

Returns

boolean

true if the specified permission has been granted, false otherwise

Parameters

permission :

string

The permission to query (e.g., stingray.AndroidPermission.READ_EXTERNAL_STORAGE, stingray.AndroidPermission.CAMERA, etc. These are equivalent to the android.Manifest.AndroidPermission - https://developer.android.com/reference/android/Manifest.permission.html)

Returns

boolean

true if the specified permission is in the AndroidManifest.xml, false otherwise

Parameters

permission :

string

The permission to request (e.g., stingray.AndroidPermission.READ_EXTERNAL_STORAGE, stingray.AndroidPermission.CAMERA, etc. These are equivalent to the android.Manifest.AndroidPermission - https://developer.android.com/reference/android/Manifest.permission.html)

Returns
This function does not return any values.

When using this function, the action that requires the permission should be delayed to the next frame (including stingray.AndroidPermission.check), as the main thread will be held at the end of the current frame, waiting for the user's input

Parameters

permission :

string

The permission to query (e.g., stingray.AndroidPermission.READ_EXTERNAL_STORAGE, stingray.AndroidPermission.CAMERA, etc. These are equivalent to the android.Manifest.AndroidPermission - https://developer.android.com/reference/android/Manifest.permission.html)

Returns

boolean

true if the user has muted requests for the specified permission, false otherwise

On Android, this is equivalent to calling !activity.shouldShowRequestPermissionRationale(permission) in the Android Java API

Parameters
This function does not accept any parameters.
Returns

boolean

true if the stingray.AndroidPermission.request function is supported