Difference between revisions of "Application:requestPermissions"

From GiderosMobile
(Created page with "__NOTOC__ '''Supported platforms:''' File:Platform android.png<br/> '''Available since:''' Gideros 2020.05<br/> '''Class:''' Application<br/> === Description === Requ...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
 
=== Description ===
 
=== Description ===
 
Requests one or multiple android permission(s) and displays the request permission screen.
 
Requests one or multiple android permission(s) and displays the request permission screen.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
application:requestPermissions({permissions})
 
application:requestPermissions({permissions})
</source>
+
</syntaxhighlight>
  
  
Line 34: Line 34:
 
=== Example ===
 
=== Example ===
 
'''Request write external storage permission'''
 
'''Request write external storage permission'''
<source lang="lua">
+
<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
</source>
+
</syntaxhighlight>
  
 
{{Application}}
 
{{Application}}

Latest revision as of 16:51, 12 July 2023

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

Description

Requests one or multiple android permission(s) and displays the request permission screen.

application:requestPermissions({permissions})


permissions 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

permissions: (table) a table of the android permission(s) to check (string(s))

Example

Request write external storage permission

if not application:checkPermission("android.permission.WRITE_EXTERNAL_STORAGE") then
application:requestPermissions({"android.permission.WRITE_EXTERNAL_STORAGE"})
end