Difference between revisions of "Application:checkPermission"
From GiderosMobile
(Created page with "__NOTOC__ '''Supported platforms:''' File:Platform android.png<br/> '''Available since:''' Gideros 2020.05<br/> '''Class:''' Application<br/> === Description === Chec...") |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
=== Description === | === Description === | ||
Checks if an android permission has been granted. | Checks if an android permission has been granted. | ||
− | < | + | <syntaxhighlight lang="lua"> |
(bool) = application:checkPermission(permission) | (bool) = application:checkPermission(permission) | ||
− | </ | + | </syntaxhighlight> |
'''permission''' possible values are: | '''permission''' possible values are: | ||
Line 36: | Line 36: | ||
=== Example === | === Example === | ||
'''Request write external storage permission''' | '''Request write external storage permission''' | ||
− | < | + | <syntaxhighlight lang="lua"> |
if not application:checkPermission("android.permission.WRITE_EXTERNAL_STORAGE") then | if not application:checkPermission("android.permission.WRITE_EXTERNAL_STORAGE") then | ||
application:requestPermissions({"android.permission.WRITE_EXTERNAL_STORAGE"}) | application:requestPermissions({"android.permission.WRITE_EXTERNAL_STORAGE"}) | ||
end | end | ||
− | </ | + | </syntaxhighlight> |
{{Application}} | {{Application}} |
Latest revision as of 17:20, 12 July 2023
Supported platforms:
Available since: Gideros 2020.05
Class: Application
Description
Checks if an android permission has been granted.
(bool) = application:checkPermission(permission)
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
if not application:checkPermission("android.permission.WRITE_EXTERNAL_STORAGE") then
application:requestPermissions({"android.permission.WRITE_EXTERNAL_STORAGE"})
end
- Application:applyStyles
- Application:canOpenUrl
- Application:checkPermission
- Application:configureFrustum
- Application:enableDrawInfo
- Application:enableOnDemandDraw
- Application:exit
- Application:get
- Application:getApiVersion
- Application:getAppId
- Application:getBackgroundColor
- Application:getClipboard
- Application:getContentHeight
- Application:getContentWidth
- Application:getDeviceHeight
- Application:getDeviceInfo
- Application:getDeviceName
- Application:getDeviceOrientation
- Application:getDeviceSafeArea
- Application:getDeviceWidth
- Application:getFps
- Application:getKeyboardModifiers
- Application:getLanguage
- Application:getLocale
- Application:getLogicalBounds
- Application:getLogicalHeight
- Application:getLogicalScaleX
- Application:getLogicalScaleY
- Application:getLogicalTranslateX
- Application:getLogicalTranslateY
- Application:getLogicalWidth
- Application:getNativePath
- Application:getOrientation
- Application:getProjectProperties
- Application:getScaleMode
- Application:getScreenDensity
- Application:getTextureMemoryUsage
- Application:isPlayerMode
- Application:openUrl
- Application:requestPermissions
- Application:set
- Application:setBackgroundColor
- Application:setClipboard
- Application:setEventMerging
- Application:setFps
- Application:setFullScreen
- Application:setKeepAwake
- Application:setKeyboardVisibility
- Application:setLogicalDimensions
- Application:setOrientation
- Application:setScaleMode
- Application:setTextInput
- Application:setWindowSize
- Application:vibrate