Start a one-to-one call
Start a one-to-one audio or video call with the Android SDK.
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
invitation | SignalingInvitationInfo | Yes | The call invitation. |
invitation.inviterUserID | String | Yes | The inviter; pass the current signed-in user ID. |
invitation.inviteeUserIDList | List<String> | Yes | The invitees; for a one-to-one call, include only the other user. |
invitation.groupID | String | Yes | Group ID. Pass an empty string for a one-to-one call. |
invitation.roomID | String | Yes | The call's unique room identifier and the primary key for subsequent state. |
invitation.timeout | long | Yes | Invitation timeout in seconds. |
invitation.mediaType | String | Yes | The application-defined media type, typically audio or video. |
invitation.sessionType | int | Yes | Use ConversationType.SINGLE_CHAT for one-to-one calls and ConversationType.SUPER_GROUP_CHAT for group calls. |
invitation.platformID | int | Yes | The current client platform; pass Platform.ANDROID. |
invitation.customData | String | No | Application extra data carried with the invitation. |
invitation.initiateTime | long | No | The invitation start time. It is normally maintained by the signaling flow and does not need to be set manually. |
offlinePushInfo | OfflinePushInfo | No | Push content used when the invitee is offline. |
offlinePushInfo.title | String | Conditionally required | Push title; required when offlinePushInfo is provided. |
offlinePushInfo.desc | String | Conditionally required | Push body; required when offlinePushInfo is provided. |
offlinePushInfo.ex | String | Conditionally required | Push extension string; pass an empty string when there is no content. |
offlinePushInfo.iOSPushSound | String | Conditionally required | iOS push sound; required when offlinePushInfo is provided. |
offlinePushInfo.iOSBadgeCount | boolean | Conditionally required | Whether to update the iOS badge; required when offlinePushInfo is provided. |
participant | ParticipantMeta | No | User, group, or group-member details for a participant; normally omitted when starting an invitation. |
userID | String | No | User 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.
Was this page helpful?