Skip to content

Customize Call Module Notifications

Kristiyan Petrov edited this page Apr 6, 2021 · 14 revisions
  • Incoming calls can be displayed as notification or activities.
  • An incoming call notification can be clicked to display the call activity. It also has buttons to decline or answer (and open call activity) the call directly from the notification.
  • All call notifications (ongoing calls or incoming calls) may be customized inside the following method onCreateNotification(callInfo, callNotificationType, callNotificationStyle)

BandyerSDK.Builder builder = new BandyerSDK.Builder(this, getString(R.string.app_id))

builder.withCallEnabled(new CallNotificationListener() {
            @Override
            public void onIncomingCall(@NonNull IncomingCall incomingCall, boolean isDnd, boolean isScreenLocked) {
                incomingCall.withConfiguration(SimpleCallConfiguration());

                if (!isDnd || isScreenLocked)
                    incomingCall
                            .show(App.this);
                else {
                    incomingCall
                            .asNotification()
                            .show(App.this);
                }
            }

            @Override
            public void onCreateNotification(@NonNull CallInfo callInfo,
                                             @NonNull CallNotificationType type,
                                             @NonNull CallNotificationStyle notificationStyle) {
                notificationStyle.setNotificationColor(Color.RED);
            }
        };
);

Configuration

SimpleCallConfiguration Most common type of configuration for call. Follow the link for more details.

SimpleChatConfiguration Most common type of configuration for chat. Follow the link for more details.

Customize Configuration Customize the configuration at your desire. Follow the link for more details.

Customize Incoming Call Configuration

private IncomingCallConfiguration getIncomingCallConfiguration() {
     return new IncomingCallConfiguration(getDefaultCallCapabilitySet(), getDefaultIncomingCallOptionSet());
}

private CallCapabilitySet getDefaultCallCapabilitySet() {
        // You may also initialize the callCapabilities without any argument in the constructor
        // You can enable a single capability using the utility methods
        // Example :
        // new CallConfiguration.CapabilitySet().withChat();
        return new CallConfiguration.CapabilitySet(
                           new ChatConfiguration(),
                           new FileShareConfiguration(),
                           new ScreenShareConfiguration(),
                           new WhiteboardConfiguration());
}

private IncomingCallOptions getDefaultIncomingCallOptionSet() {
        // You may also initialize the callOptions without any argument in the constructor
        // You can enable a single option using the utility methods
        // Example :
        // new IncomingCallOptions().withBackCameraAsDefault();
        return new IncomingCallOptions();
                //.withAutoAnswer()
                //.withBackCameraAsDefault()
                //.withProximitySensorDisabled();
}
Clone this wiki locally