Integrate the ZIM Audio SDK
This topic describes how to integrate the ZIM Audio SDK.
Prerequisites
Before you integrate the ZIM Audio SDK, make sure that the following conditions are met:
- Development environment:
- Android Studio 2020.3.1 or later is installed.
- Android SDK 25, Android SDK Build-Tools 25.0.2, Android SDK Platform-Tools 25.x.x or later is installed. -Android 4.4 devices with voice functionality support.
Import the ZIM Audio SDK
The currently supported platform architectures include: armeabi-v7a, arm64-v8a, x86, and x86_64.
You can integrate the SDK through any of the following methods.
Setting permissions
You can set the required permissions for the application based on the actual application needs.
Go to the "app/src/main" directory, open the "AndroidManifest.xml" file, and add the permissions.
<!-- Required permissions for the SDK -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Due to the requirement for Android 6.0 and higher versions to request dynamic permissions for some critical permissions, it is not enough to only apply for static permissions through the "AndroidManifest.xml" file. Therefore, you also need to refer to the following code, where "requestPermissions" is a method of the "Activity".
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) !=
PackageManager.PERMISSION_GRANTED) {
String[] permissions = {Manifest.permission.RECORD_AUDIO};
requestPermissions(permissions, PERMISSION_REQUEST_CODE);
}
}
The specific permission details are as follows:
Necessity | Permission | Description | Reason for Request |
---|---|---|---|
Required permission | RECORD_AUDIO | Audio recording permission. | This permission is needed to send audio. |
Prevent confusion
In the "proguard-rules.pro" file, add the -keep
class configuration for the SDK to prevent confusion with the SDK public class names.
-keep class **.zego.**{*;}