Declare your app's audio permissions

Add the following to your AndroidManifest.xml, inside the bottom of the element.

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

If your application uses Trill SDK as a receiver, the application would need to ask record audio permissions from the user. To facilitate the same, follow the below steps:

Make sure the SDK is initialised after the permission block.

String[] neededPermissions = {
       Manifest.permission.RECORD_AUDIO
};

if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
   ActivityCompat.requestPermissions(this, neededPermissions, 1);
} else {
    // Instantiate TrillSDK
}

To do so check if Manifest.permission.RECORD_AUDIO is available for the application, if not ask for permission. Once permission is given by USER, TrillSDK can be initialised.

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
   super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    // Instantiate TrillSDK
}

Last updated