This topic describes how to integrate Push SDK for Flutter.
Prerequisites
Android Studio or Visual Studio Code is installed.
Environment requirements
Item | Description |
Flutter version | Flutter 2.5.0 and later are supported. For more information about how to download Flutter, see Flutter SDK archive. |
Dart version | Versions equal to or later than 2.12.0 and earlier than 3.0.0 are supported. |
OS version | Android 5.0 and later are supported. |
CPU architecture | armeabi-v7a and arm64-v8a are supported. |
Development tool | We recommend that you use Android Studio or Visual Studio Code. |
Procedure
Add the following dependency to the pubspec.yaml file of your local project:
dependencies: flutter_livepush_plugin: ^{{latest version}}
NoteFor information about the latest version of flutter_livepush_plugin, see flutter_livepush_plugin.
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 live streaming</string> <key>NSMicrophoneUsageDescription</key> <string>Authorize access to the microphone for audio live 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 information about 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 request and configure a Push SDK license, see Integrate a Push SDK license.
References
For information about the API operations that are related to Push SDK for Flutter, see API reference.
For information about the sample code that demonstrates how to use API operations, see Use Push SDK for Flutter.