Ocean
Ocean::Platform::Android::Permission Class Reference

This class implements functions for Android application permissions. More...

Static Public Member Functions

static bool hasPermission (JavaVM *javaVM, jobject activity, const std::string &permission, bool &state, const bool translate=true)
 Returns whether the Android app has a specific permission. More...
 
static bool requestPermissions (JavaVM *javaVM, jobject activity, const std::vector< std::string > &permissions, const bool translate=true)
 Requests several permissions for the Android app. More...
 
static std::string translatePermission (JNIEnv *jniEnv, const std::string &permission)
 Determines Android's internal permission name for a readable permission. More...
 

Detailed Description

This class implements functions for Android application permissions.

Member Function Documentation

◆ hasPermission()

static bool Ocean::Platform::Android::Permission::hasPermission ( JavaVM *  javaVM,
jobject  activity,
const std::string &  permission,
bool &  state,
const bool  translate = true 
)
static

Returns whether the Android app has a specific permission.

Parameters
javaVMThe Java virtual machine, must be valid
activityThe Android main activity, must be valid
permissionThe permission to be checked, must be valid
translateIf true, translates short permission name to Android-internal full permission name, note: must be false for Oculus permissions, e.g., com.oculus.permission.USE_SCENE
stateTrue, if the app has the specified permission; False, if the app does not have the specified permission
Returns
True, if succeeded

◆ requestPermissions()

static bool Ocean::Platform::Android::Permission::requestPermissions ( JavaVM *  javaVM,
jobject  activity,
const std::vector< std::string > &  permissions,
const bool  translate = true 
)
static

Requests several permissions for the Android app.

Parameters
javaVMThe Java virtual machine, must be valid
activityThe Android main activity, must be valid
permissionsThe permissions to be requested, at least one
translateIf true, translates short permission name to Android-internal full permission name, note: must be false for Oculus permissions, e.g., com.oculus.permission.USE_SCENE
Returns
True, if the request was invoked successfully, does not check whether the permission was granted

◆ translatePermission()

static std::string Ocean::Platform::Android::Permission::translatePermission ( JNIEnv *  jniEnv,
const std::string &  permission 
)
static

Determines Android's internal permission name for a readable permission.

Parameters
jniEnvThe Java environment, attached with the current thread, must be valid
permissionThe readable permission
Returns
Android's internal permission

The documentation for this class was generated from the following file: