CiCare RTC SDK for Flutter

cicare_rtc_flutter is a powerful Flutter plugin for real-time communication (RTC) that supports App-to-App and SIP calling. It features a modern, WhatsApp-inspired user interface for Android and integrates seamlessly with Firebase Cloud Messaging (FCM) for reliable call notifications.

Features

  • 📞 App-to-App Calling: High-quality VoIP calls between users.
  • ☎️ SIP Calling: Support for traditional SIP destinations.
  • 🔔 FCM Integration: Wake up the device and show incoming call UI even when the app is in the background or killed.
  • 📱 WhatsApp-style UI: Customizable and familiar calling interface for Android.
  • 🔒 Secure: Checksum-based validation for call initiation.

Requirements

  • Flutter: 3.35.4
  • Dart: >=3.4.0 <4.0.0
  • Android:
    • minSdkVersion: 24
    • targetSdkVersion: 34
    • compileSdkVersion: 34
  • iOS: (Configuration required in Info.plist)

Installation

Add the dependency to your pubspec.yaml:

dependencies:
  cicare_rtc_flutter:
    path: path/to/cicare_rtc_flutter

Then run:

flutter pub get

Android Setup

1. AndroidManifest.xml

The SDK requires several permissions and services. These are mostly included in the plugin's AndroidManifest.xml, but ensure your main app allows them, especially:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

2. Firebase Mapping

Register the CiCareFirebaseMessagingService in your app's AndroidManifest.xml (the plugin handles this automatically if merged correctly):

<service
    android:name="cc.cicare.cicare_rtc_flutter.CiCareFirebaseMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Usage

1. Initialization

Set up your API configuration before making any calls.

final _sdk = CicareRtcFlutter();

_sdk.setAPI(
  baseUrl: "https://your-api-endpoint.com/",
  token: "your_auth_token",
);

2. Listening for Call States

Listen to call states to update your UI (e.g., in a ValueNotifier or Bloc).

CicareRtcFlutter.setOnCallStateChanged((state) {
  print('Call state changed: $state');
  // Possible states: idle, calling, ringing, connected, ended, error, etc.
});

CicareRtcFlutter.setOnCallError((code, message) {
  print('Call Error: [$code] $message');
});

3. Making a Call (App-to-App)

await _sdk.makeCall(
  callerId: "user_123",
  callerName: "John Doe",
  calleeId: "user_456",
  calleeName: "Jane Smith",
  calleeAvatar: "https://example.com/avatar.png",
  checkSum: "your_calculated_checksum",
  metaData: {'type': 'app-to-app'},
);

4. Making a SIP Call

await _sdk.makeCallSip(
  callerId: "user_123",
  callerName: "John Doe",
  destination: "6001",
  destinationName: "Office Phone",
  checkSum: "your_calculated_checksum",
);

5. Handling Incoming Calls (FCM)

The SDK expects a Data Message payload from Firebase with the following structure:

{
  "to": "fcm_token",
  "data": {
    "type": "incoming_call",
    "callerId": "123",
    "calleeId": "456",
    "callerName": "John Doe",
    "checkSum": "...",
    "metaData": "{ \"key\": \"value\" }"
  }
}

License

This project is licensed under the terms of the LICENSE file included in the root of the project.


Support

For issues or inquiries, please visit cicare.cc.