Browse SDKs · Android
SDKsAndroidEnterprise

Start a one-to-one call

Start a one-to-one audio or video call with the Android SDK.

Copy

signalingInvite() starts a one-to-one call. The Android SDK handles call signaling; your application must connect a real-time audio/video engine with the returned room credentials.

Parameters

Call signature:

signalingInvite(OnBase<SignalingCertificate> callback, SignalingInfo info)

The table covers the public fields of Android SignalingInfo and its nested objects. When starting a call, populate invitation and, optionally, offlinePushInfo. participant and the top-level userID are used when signaling data is received and normally do not need to be set by the caller.

ParameterTypeRequiredDescription
invitationSignalingInvitationInfoYesThe call invitation.
invitation.inviterUserIDStringYesThe inviter; pass the current signed-in user ID.
invitation.inviteeUserIDListList<String>YesThe invitees; for a one-to-one call, include only the other user.
invitation.groupIDStringYesGroup ID. Pass an empty string for a one-to-one call.
invitation.roomIDStringYesThe call's unique room identifier and the primary key for subsequent state.
invitation.timeoutlongYesInvitation timeout in seconds.
invitation.mediaTypeStringYesThe application-defined media type, typically audio or video.
invitation.sessionTypeintYesUse ConversationType.SINGLE_CHAT for one-to-one calls and ConversationType.SUPER_GROUP_CHAT for group calls.
invitation.platformIDintYesThe current client platform; pass Platform.ANDROID.
invitation.customDataStringNoApplication extra data carried with the invitation.
invitation.initiateTimelongNoThe invitation start time. It is normally maintained by the signaling flow and does not need to be set manually.
offlinePushInfoOfflinePushInfoNoPush content used when the invitee is offline.
offlinePushInfo.titleStringConditionally requiredPush title; required when offlinePushInfo is provided.
offlinePushInfo.descStringConditionally requiredPush body; required when offlinePushInfo is provided.
offlinePushInfo.exStringConditionally requiredPush extension string; pass an empty string when there is no content.
offlinePushInfo.iOSPushSoundStringConditionally requirediOS push sound; required when offlinePushInfo is provided.
offlinePushInfo.iOSBadgeCountbooleanConditionally requiredWhether to update the iOS badge; required when offlinePushInfo is provided.
participantParticipantMetaNoUser, group, or group-member details for a participant; normally omitted when starting an invitation.
userIDStringNoUser associated with the current signaling action; normally omitted when starting an invitation.
SignalingInvitationInfo invitation = new SignalingInvitationInfo();
invitation.setInviterUserID(currentUserID);
invitation.setInviteeUserIDList(Collections.singletonList(peerUserID));
invitation.setGroupID("");
invitation.setRoomID(roomID);
invitation.setTimeout(30);
invitation.setMediaType("video");
invitation.setSessionType(ConversationType.SINGLE_CHAT);
invitation.setPlatformID(Platform.ANDROID);
invitation.setCustomData("{\"source\":\"contact-card\"}");

SignalingInfo info = new SignalingInfo();
info.setInvitation(invitation);
info.setOfflinePushInfo(offlinePushInfo);

OpenIMClient.getInstance().signalingManager.signalingInvite(
    new OnBase<SignalingCertificate>() {
        @Override
        public void onSuccess(SignalingCertificate credentials) {
            // credentials provides the roomID, token, and liveURL for joining a media room.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    },
    info
);

The success callback returns SignalingCertificate. roomID identifies the media room, token is a short-lived join credential, liveURL is the media service address, and busyLineUserIDList contains busy users.

Connect the media engine only after receiving a valid token and roomID. API success does not mean the invitee accepted; merge subsequent state through Handle call events.