Search code examples
androidsinchandroid-sinch-api

Pass extra data with Sinch VideoCalling


Here is code how i have implemented calling.

@Override
public void onClientStarted(SinchClient sinchClient) {
  Log.e(TAG, "started");

  callClient = sinchClient.getCallClient();
  callClient.addCallClientListener(this);
}
public void initiateCall(String receiverId) {
  Call call = callClient.callUserVideo(receiverId);
  call.addCallListener(this);
}

But i want to pass some data like username, profile image and other things, does there any way to pass those data with video calling?


Solution

  • Got solution from sinch developer.

    You can pass along custom data providing headers to the callUserVideo(String toUserId, Map headers) method. The headers you pass can be retrieved from the incoming Call object using getHeaders() method. https://download.sinch.com/docs/android/latest/reference/com/sinch/android/rtc/calling/Call.html

    We can pass extra values in map when initializing call.

    HashMap<String,String> map=new HashMap<>();
    map.put("userId","5");
    map.put("profileImage","image url");
    
    Call call = callClient.callUserVideo(receiverId,map);