flutter_voip_kit_osato07 0.1.5 copy "flutter_voip_kit_osato07: ^0.1.5" to clipboard
flutter_voip_kit_osato07: ^0.1.5 copied to clipboard

A comprehensive VoIP kit for Flutter enabling iOS CallKit/PushKit and Android ConnectionService/FCM.

Flutter VoIP Kit Template #

This project provides a "ready-to-use" implementation for cross-platform VoIP calls (Audio/Video) using Flutter, Firebase, and CallKit/ConnectionService.

🌟 Features #

  • Library-based Architecture: Core logic is encapsulated in packages/flutter_voip_kit_osato07.
  • iOS: Native PKPushRegistry integration for standard-compliant VoIP handling.
  • Android: High-priority FCM Data Message handling with full-screen intent support.

🛠 Prerequisites #

  1. Firebase Project: Create one at console.firebase.google.com.
  2. Apple Developer Account: Required for VoIP Certificates.

🍎 iOS Setup (Critical) #

VoIP on iOS requires precise configuration. One missed step will cause silent failures.

1. Xcode Capabilities #

Open ios/Runner.xcworkspace in Xcode. Select your target (Runner) -> Signing & Capabilities.

  1. + Capability -> Background Modes -> Check:
    • Audio, AirPlay, and Picture in Picture
    • Voice over IP
    • Remote notifications
  2. + Capability -> Push Notifications (if not already added).

2. APNs Authentication Key (.p8) #

  1. Go to Apple Developer Console -> Keys.
  2. Create a new Key (+ button).
  3. Name it (e.g., "VoIP and Push Key") and check Apple Push Notifications service (APNs).
  4. Download the .p8 file. Keep it safe (you can only download it once).
  5. Get your Key ID and Team ID from the console.

3. Connection to Backend (Two Options) #

You need to send VoIP pushes to APNs (Apple Push Notification service).

If you rely on admin.messaging().send() in your Cloud Functions:

  1. Go to Firebase Console -> Project Settings -> Cloud Messaging -> Apple app configuration.
  2. Upload the APNs Authentication Key (.p8) you created in Step 2.
    • You will need the Key ID and Team ID.

Option B: Direct APNs in Cloud Functions (Advanced)

If you want to read certificates directly in index.ts:

  1. Place your voip_cert.p12 (or key) inside functions/certs/.
  2. Use a library like node-apn instead of firebase-admin for the iOS part.
    // In functions/index.ts (Pseudocode)
    import * as apn from 'apn';
    const apnProvider = new apn.Provider({
       pfx: "certs/voip_cert.p12",
       production: true // true for TestFlight/AppStore
    });
    // Send using apnProvider...
    
    The provided template currently uses Option A (Firebase Admin).

🤖 Android Setup #

1. Firebase Config #

  1. Download google-services.json from Firebase Console.
  2. Place it in: android/app/google-services.json.

2. Permissions (Automated) #

The library flutter_voip_kit_osato07 automatically injects required permissions:

  • FOREGROUND_SERVICE
  • WAKE_LOCK
  • POST_NOTIFICATIONS
  • READ_PHONE_STATE

You do NOT need to edit AndroidManifest.xml manually for these.


☁️ Backend (Cloud Functions) #

The functions/index.ts determines how calls are routed.

1. Key Logic (Simulating VoIP) #

We rely on Push Types to tell the OS this is a call.

  • Android: We send a data message with "callType": "voip_incoming".
  • iOS: We send an APNs payload with headers:
    "headers": {
      "apns-push-type": "voip",
      "apns-priority": "10",
      "apns-topic": "com.your.bundle.id.voip" 
    }
    
    (Note: .voip suffix is often required depending on how you send it).

2. Deployment #

firebase deploy --only functions

🚀 Usage in Flutter #

1. Add Dependency #

In pubspec.yaml:

dependencies:
  flutter_voip_kit_osato07:
    path: ./packages/flutter_voip_kit_osato07

2. Initialize #

In lib/main.dart:

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MainApp());
}

// Inside your State class
@override
void initState() {
  super.initState();
  
  FlutterVoipKit().initialize(
    onEvent: (event) {
      if (event.event == Event.actionCallAccept) {
        // User answered! Navigate to Screen.
      }
    }
  );
  
  // Submit this token to your backend!
  FlutterVoipKit().getFcmToken().then((token) {
     // Save FCM token (Android/iOS Standard)
  });

  // iOS only: Save VoIP Token
  FlutterVoipKit().getVoIPToken().then((token) {
      if (token != null) {
          // Save VoIP token to Firestore
      }
  });

  // Listen for VoIP token updates (iOS only)
  FlutterVoipKit().onTokenRaw.listen((token) {
      // Update token in backend
  });
}
0
likes
0
points
353
downloads

Publisher

unverified uploader

Weekly Downloads

A comprehensive VoIP kit for Flutter enabling iOS CallKit/PushKit and Android ConnectionService/FCM.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

firebase_core, firebase_messaging, flutter, flutter_callkit_incoming, plugin_platform_interface, uuid

More

Packages that depend on flutter_voip_kit_osato07

Packages that implement flutter_voip_kit_osato07