With CONTUS MirrorFly Call SDK for Flutter, you can easily add real-time call features to your client app within 30 minutes. Through our client SDK, you can initialize and configure chat into your app with minimal efforts.
Note : If you're looking for the fastest way to build your app’s UI with MirrorFly Chat Plugin, you can use our sample apps. To get our sample apps, click here
The requirements for Android Call SDK are:
- Android Lollipop 5.0 (API Level 21) or above
- Java 7 or higher
- Gradle 4.1.0 or higher
The requirements for iOS Call SDK are
- Xcode 14.1 or later
- iOS 12.1 or later
- Swift 5.0 or later
Skip this step if you are already having your license key.
To integrate MirrorFly Call SDK into your app, you will need a SDK License Key. The MirrorFly server will use this license key to authenticate the SDK in your application.
Step 1: Sign up for a MirrorFly Account
Step 2: Log into your Account
Step 3: Get the License key from the
application Info section
Step 4: Add the following to your root
build.gradle file in your Android folder.
Add the following dependencies in the
Step 5: Check and Add the following code at end of your
Step 6 : Now, disable the bitcode for your project
Step 7: Now, enable all the below mentioned capabilities into your project.
Now, go to the background mode and enable the below given modes | Background Modes | | -------------------| |Audio,Airplay, and Picture in Picture | |Voice over IP | |Background fetch | |Remote notifications |
Step 8: Add the below dependencies in
STEP 9: Run
flutter pub get command in your project directory. You can use all classes and methods just with the following import statement
To initialize the plugin, place the below code in your
main.dart file inside
main function before
|baseUrl||Url is provided to make API calls|
|licenseKey||License key is required to proceed with registration|
|iOSContainerID||Create App groups and assign the obtained group container id. Plugin uses this string to create the path for the local storage.|
The base URL must have the Http/Https protocol which must be closed with a ‘slash (/)’, if not an exception - a bug message will pop up.
Note: While registration, the below
registerUsermethod will accept the
FCM_TOKENas an optional param and pass it across.
The connection will be established automatically upon completion of registration and not required for seperate login.
|userIdentifier||A unique Id to Register the User. We accept only the AlphaNumeric String|
|token||A registration token that is generated by FCM Plugin for the user's app instance to send message for free|
Some of the most common terminologies used in MirrorFly Plugin with description | keyword | Explanation | | --- | --- | | userID/userBareID | Unique ID assigned for each user Ex: 12345678 (any alphanumeric). The below characters is not allowed in userId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@) userID should follow below specification: https://xmpp.org/extensions/xep-0106.html | | userJid (or) JID | userID+@+domain of the chat server Ex. firstname.lastname@example.org | | groupID/groupBareID | Unique ID assigned for each group Ex: group123456 (any alphanumeric). GroupJID = groupID +@mix.+domain of the chat server Ex: email@example.com` |
To make and receive a voice/video call, Microphone and Camera usage permissions were required. Make Sure those permissions are granted
If one to one call feature unavailable for your plan then it will throw 403 exception.
From Android 12, ensure that
android.permission.READ_PHONE_STATEruntime permissions are granted for your app for seameless audio routing and gsm call handling. If the
android.permission.BLUETOOTH_CONNECTpermission is not granted, call audio will not be routed to BT Headset even though it is connected. If the
android.permission.READ_PHONE_STATEpermission is not granted, gsm call related functionalities will not work in sdk.
Note: From Android 13, CallSDK need below permission to show ongoing call notification.Manifest.permission.POST_NOTIFICATIONS
To make a one to one voice call, call the below method.
|USER_JID||Jid of another registered user|
Call SDK will take care of receiving and processing the received call payload and triggering the
CallKit for iOS and
Incoming Call Intent for Android is presented, if you are connected to the server in foreground state.
Once the Call is being presented with Accept/Reject Call buttons, we can either choose to attend or reject the call. If we attend the call the below event listener
onCallStatusUpdated will be triggered, and the status will be of the case
|callMode||For this callMode |
|userJid||For this |
|callType||For this callType |
|callStatus||An enum class defines the current status of the call|