Application:checkPermission

From GiderosMobile
Revision as of 17:12, 12 July 2023 by Hgy29 (talk | contribs) (Text replacement - "</source" to "</syntaxhighlight")

Supported platforms: Platform android.png
Available since: Gideros 2020.05
Class: Application

Description

Checks if an android permission has been granted. <source lang="lua"> (bool) = application:checkPermission(permission) </syntaxhighlight>

permission possible values are:

  • "android.permission.ACCESS_COARSE_LOCATION"
  • "android.permission.ACCESS_FINE_LOCATION"
  • "android.permission.ACCESS_NETWORK_STATE"
  • "android.permission.ACCESS_WIFI_STATE"
  • "android.permission.CAMERA"
  • "android.permission.CHANGE_WIFI_STATE"
  • "android.permission.INTERNET"
  • "android.permission.READ_EXTERNAL_STORAGE"
  • "android.permission.RECORD_AUDIO"
  • "android.permission.VIBRATE"
  • "android.permission.WRITE_EXTERNAL_STORAGE"
  • "android.permission.WAKE_LOCK"
  • "com.android.vending.CHECK_LICENSE"
  • "com.yourdomain.yourapp.permission.C2D_MESSAGE"

Parameters

permission: (string) the android permission to check

Return values

Returns (bool) if the permission was granted

Example

Request write external storage permission <source lang="lua"> if not application:checkPermission("android.permission.WRITE_EXTERNAL_STORAGE") then application:requestPermissions({"android.permission.WRITE_EXTERNAL_STORAGE"}) end </syntaxhighlight>