Help Lightning API Documentation / Tutorials / Using the Miniview with the Android SDK

Using the Miniview with the Android SDK

This document is the tutorial for enabling the miniview feature on Android. This feature was first made available in version 3.0.2.

  1. Ensure that you return true for the new HLClientDelegate method isMinimizeCallEnabled()
  • remember to call HLClient.setHLClientDelegate(your_delegate)
  1. Create a View to display the call information:

  2. observe LiveData from HLClient:

// Observer miniview data
HLClient.INSTANCE.getMinimizedCall().observe(getViewLifecycleOwner(), new Observer<OngoingCallInfo>() {
    public void onChanged(OngoingCallInfo ongoingCallInfo) {
        if (ongoingCallInfo != null) {
            ongoingCallMiniView.setCallInfo(ongoingCallInfo.getMiniView(), ongoingCallInfo.getCallTitle());
        } else {
            ongoingCallMiniView.setCallInfo(null, null);
        }
    }
});

OngoingCallInfo is a simple data class with 2 properties:

  • miniView: View
  • callTitle: String The miniView is the shared view of the call. The sdk will handle updating the view. You can put it whereever you want. The callTitle gives some indication about who is in the call. This might say “Guest”, “Active session with …”, or “Waiting for [pariticipant] to join”.
  1. Tie functionality back to the HLClient. You have the ability to endActiveCall(<FragmentActivity>) and returnToActiveCall(). endActiveCall will remove yourself from the call. returnToActiveCall will maximize the call Activity again.
ongoingCallMiniView.setOngoingCallListener(new OngoingCallListener() {
    public void onMaximizeCall() {
        HLClient.INSTANCE.returnToActiveCall();
    }

    public void onEndCall() {
        HLClient.INSTANCE.endActiveCall(getActivity());
    }
});
  1. If you are extending InCallService, you must call super on onCallEnded.
/**
 * Called when a call has ended.
 *
 * @param call   The call that ended.
 * @param reason The reason the call ended.
*/
@Override
public void onCallEnded(HLCall call, String reason) {
    super.onCallEnded(call, reason);
}