Quick start
Integrate the SDK
Add ZegoUIKitPrebuiltCall as dependencies
- Edit your project's pubspec.yaml and add local project dependencies
dependencies:
flutter:
sdk: flutter
zego_uikit_prebuilt_call: ^0.0.2 # Add this line
- Execute the command as shown below under your project's root folder to install all dependencies
flutter pub get
Import the SDK
Now in your Dart code, import the prebuilt SDK.
import 'package:zego_uikit_prebuilt_call/zego_uikit_prebuilt_call.dart';
Using the ZegoUIKitPrebuiltCall in your project
You can get appID
and appSign
from ZEGOCLOUD's Admin Console. Pick up the userID
and userName
for connecting to ZEGOCLOUD's service. And you should also pick up a callID
for making a new call.
userID
andcallID
can only contain numbers, letters, and underlines (_).- Users that join the call with the same
callID
can talk to each other.
class CallPage extends StatelessWidget {
const CallPage({Key? key, required this.callID}) : super(key: key);
@override
Widget build(BuildContext context) {
return ZegoUIKitPrebuiltCall(
appID: yourAppID,
appSign: yourAppSign,
userID: userID,
userName: userName,
callID: callID,
config: ZegoUIKitPrebuiltCallConfig(),
);
}
}
Now, you can make a new call by navigating to this CallPage
.
Build & Run
1. Config your project
Android
- If your project was created with a version of flutter that is not the latest stable, you may need to manually modify compileSdkVersion in
your_project/android/app/build.gradle
to 33
- Need to add app permissions, Open the file
your_project/app/src/main/AndroidManifest.xml
, add the following code:<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
iOS
Need add app permissions, open your_project/ios/Runner/Info.plist
, add the following code inside the dict
tag:
<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a call</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a call</string>
2. Run & Debug
Now you can simply click the Run or Debug button to build and run your App on your device.