logo
On this page

FAQ

I have two different apps that need to support offline calling with each other. How should I configure them?

  1. First, you need to configure the index 2 certificate for the second app in the ZEGOCLOUD admin console.

Then, you need to set the certificateIndex of the second app to secondCertificate in the place where you initialize the ZegoUIKitPrebuiltCallInvitationService on the client side.

await ZegoUIKitPrebuiltCallInvitationService().init(
  appID: yourAppID /*input your AppID*/,
  appSign: yourAppSign /*input your AppSign*/,
  userID: currentUser.id,
  userName: currentUser.name,
  //...
  notificationConfig: ZegoCallInvitationNotificationConfig(
    iOSNotificationConfig: ZegoIOSNotificationConfig(
      certificateIndex: ZegoSignalingPluginMultiCertificate.secondCertificate,
    ),
  ),
  // ...
)

Read Delaying Auto-entry into Offline Calls After App Launch for solution.

Warning
Please ensure that the certificates on the console correspond one-to-one with the certificateIndex in your code.

When zego_uikit_prebuilt_call receives a message from FCM, it sends a broadcast to the current application with action com.zegocloud.zegouikit.call.fcm when the message is not from Zego SDK, similar to the following code:

Intent intent = new Intent("com.zegocloud.zegouikit.call.fcm");
intent.putExtra("remoteMessage", remoteMessage);
context.sendBroadcast(intent);

Therefore, if you have already integrated Firebase Messaging, you only need to follow these steps to complete the migration:

  1. Create and statically register a BroadcastReceiver in your application:

    • Create a BroadcastReceiver, for example,YourCustomBroadcastReceiver.java.
    • Register it to the application node of your application's Manifest.xml file, and set the action to "com.zegocloud.zegouikit.call.fcm", for example:
    <receiver
         android:name="com.zegocloud.uikit.demo.calloffline.YourCustomBroadcastReceiver"
         android:enabled="true"
         android:exported="false">
         <intent-filter>
           <action android:name="com.zegocloud.zegouikit.call.fcm"/>
         </intent-filter>
     </receiver>
  2. Remove your original FCM Service in Manifest.xml,it looks like:

    <service
        android:name=".java.MyFirebaseMessagingService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

    please remove it to avoid conflict with Zego SDK.

  3. Listen and handle the relevant events: You have to migrate your logic from MyFirebaseMessagingService to YourCustomBroadcastReceiver as follow.

    original code:

    public class YourFirebaseMsgService extends FirebaseMessagingService {
         @Override
         public void onMessageReceived(RemoteMessage remoteMessage) {
             // your custom logic
         }
     }

    please migrate like this,and delete YourFirebaseMsgService.java then:

    public class YourCustomBroadcastReceiver extends BroadcastReceiver {
    
         private static final String TAG = "CustomReceiver";
    
         public void onReceive(Context context, Intent intent) {
             com.google.firebase.messaging.RemoteMessage remoteMessage = intent.getParcelableExtra("remoteMessage");
             //  your custom logic
             Log.d(TAG, "onReceive.remoteMessage.getData: " + remoteMessage.getData());
         }
     }

With these steps, you should be able to receive and handle your own FCM messages.

Previous

Callbacks for call invitation

Next

Screen sharing

On this page

Back to top