Developer Documentation

Android Permissions

In this guide we’ll show you how to set up Android permissions required to fully use the Odin Plugin in Unreal. These settings will also work for your Meta Quest VR projects.

By David Liebemann at SciCode Studio.

Check and request permissions

We’ll make sure to check our permissions before we actually initialize Odin. The implementation gets called right after BeginPlay in the Custom Event ConnectToRoom that only replicates on the owning client. This ensures that we don’t accidentally request permissions or try to initialize Odin on our server.

Custom event that only replicates on the owning client.

Custom event that only replicates on the owning client.

The steps for checking and requesting permissions now are:

  1. We’ll use Get Platform Name to check our current platform - if we’re not on the Android platform, we can instantly go to Init Odin, which contains our logic for joining an Odin room. Otherwise we’ll continue with step 2.
Info

The platform name will also be Android on the Meta Quest.

  1. A call to Check Android Permission with the input android.permission.RECORD_AUDIO will tell us if the user already supplied the microphone permission. If yes, we can jump to Init Odin again, otherwise we’ll need to request the permission.

  2. Before requesting, we’ll need to add a Delay node with an arbitrary duration. This is due to an Unreal issue, that crashes the application if permissions are requested too early. After the delay, we’ll call Request Android Permission with an array that has an android.permission.RECORD_AUDIO entry. The function returns a delegate that allows us to connect to a callback event once the permission was granted or declined.

  3. In the callback, we’ll simply iterate over the result arrays and check for our android.permission.RECORD_AUDIO permission. If the permission was granted successfully, we’ll continue to Init Odin.

The complete blueprint should now look something like this:

Complete permissions blueprint.

Complete permissions blueprint.

Add permissions to manifest

In addition to setting up the request in blueprint, we’ll also need to add the record audio permission in the Android Manifest file. We’ll do this by opening up the project settings, navigating to Android > Advanced APK Packaging and adding the value android.permission.RECORD_AUDIO to the Extra Permissions array.

Android permissions in the project settings.

Android permissions in the project settings.

What’s next?

We’ve shown you the minimal version for checking and requesting microphone permissions for the Android and Meta Quest platform in Unreal.

If a player refuses to give the microphone permission, we currently simply refuse to initialize Odin. In a more sophisticated app we could still allow the player to listen in to the Voice Chat, while not being able to transmit. If the player changes their mind, we could provide a UI element, which reruns the request permissions logic and initializes microphone capturing, if the permission is then granted.

For even more information on Unreal with Odin Voice Chat, check out our Discord and take a look at the following guides we’ve prepared for you:

Join us on Discord

Getting started with ODIN

Follow this guide to learn how to install and setup ODIN in your Unreal Project using Blueprint.

Blueprint Reference

Check out our extensive Blueprint reference to learn more about the nodes our SDK provides and how to connect them into your game.