Documentation

Support

Vivox Unreal SDK

Vivox Unreal SDK

Request runtime permissions

Request runtime permissions for microphone access on Android.
Read time 1 minuteLast updated 2 days ago

To ensure that your Unreal Android application will properly work with the Vivox SDK, you need to request the
android.permission.RECORD_AUDIO
and, on Android 12 and later, the
android.permission.BLUETOOTH_CONNECT
permissions at runtime. To do this, use
UAndroidPermissionFunctionLibrary::CheckPermission
to check if these permissions are granted, and
UAndroidPermissionFunctionLibrary::AcquirePermissions
to request the permission for the user.
The following code is an example of this process:
#if PLATFORM_ANDROIDconst FString BluetoothConnectPermission = TEXT("android.permission.BLUETOOTH_CONNECT");if (!UAndroidPermissionFunctionLibrary::CheckPermission(BluetoothConnectPermission)) { permissions.Add(BluetoothConnectPermission); UAndroidPermissionFunctionLibrary::AcquirePermissions(permissions);}#endif
You also need to add the
AndroidPermission
module into the dependency in the
[PROJECT].build.cs
file. For example:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AndroidPermission" });
For more information on how to request permissions by using the Blueprint API, refer to the the Unreal documentation on Android Permission.