This topic describes how to integrate Push SDK for Flutter.
Prerequisites
Android Studio or Visual Studio Code is installed.
Environment requirements
Item | Requirement |
Flutter version | 2.5.0 or later. For more information about how to download Flutter, see Flutter SDK archive. |
Dart version | Versions between 2.12.0 and 3.0.0. |
OS version | Android 5.0 or later. |
CPU architecture | armeabi-v7a or arm64-v8a. |
Development tool |
Procedure
Add the following dependency to the pubspec.yaml file of your local project:
dependencies: flutter_livepush_plugin: ^{{latest version}}
NoteSee flutter_livepush_plugin for the latest version.
Add relevant system permission statements.
Android:
Open the ./android/app/src/main/AndroidManifest.xml file and declare the required permissions.
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
iOS:
Add the configurations that authorize access to the camera and microphone to the Info.plist file of the project.
<key>NSCameraUsageDescription</key> <string>Authorize access to the camera for video streaming</string> <key>NSMicrophoneUsageDescription</key> <string>Authorize access to the microphone for audio streaming</string>
Configure other project settings.
In Android, add the following rules to the obfuscation rule file.
NoteIf obfuscation is enabled for your application, you must configure obfuscation rules. Otherwise, a crash occurs when you use Push SDK. For the latest obfuscation configuration, see the source code of the demo.
-keep class org.webrtc.** { *; } -keep class com.alivc.** { *; } -keep class com.aliyun.** { *; } -keep class com.cicada.** { *; }
Configure a license.
An all-in-one license is used together with Push SDK for Flutter. For more information about how to apply for and configure a license, see Integrate a Push SDK license.
SDK usage notes
For more information about the methods, see Methods.
For information about the sample code of the methods, see Use Push SDK for Flutter.