Skip to content

Customize Call Module Notifications

Federico Marin edited this page Mar 20, 2020 · 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.withCapabilities(getDefaultCallCapabilities());
                incomingCall.withOptions(getDefaultIncomingCallOptions());

                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);
            }
        };
);
Clone this wiki locally