-
Notifications
You must be signed in to change notification settings - Fork 4
Customize Chat Module Notifications
Kristiyan Petrov edited this page Mar 6, 2019
·
9 revisions
- Incoming chat messages can be displayed as notification or activities.
- All chat notifications may be customized inside the following method: onCreateNotification(chatInfo, chatNotificationStyle)
All the notifications have a default behaviour which will be triggered when action.execute(); is called
- Default action is to open the chat if possible, otherwise the application will be launched.
BandyerSDK.Builder builder = new BandyerSDK.Builder(this, getString(R.string.app_id))
builder.withChatEnabled(new ChatNotificationListener() {
@Override
public void onIncomingChat(@NonNull IncomingChat chat, boolean isDnd, boolean isScreenLocked) {
chat.asNotification(App.this).show();
}
@Override
public void onCreateNotification(@NonNull ChatInfo chatInfo,
@NonNull ChatNotificationStyle notificationStyle) {
notificationStyle.setNotificationColor(Color.RED);
notificationStyle.setNotificationSmallIcon(R.drawable.ic_notification);
}
@Override
public void onChatActivityStartedFromNotificationAction(@NonNull ChatInfo chatInfo,
@NonNull ChatIntentOptions chatIntentOptions) {
chatIntentOptions
.withAudioCallCapability(false, true)
.withWhiteboardInCallCapability()
.withAudioVideoCallCapability(false);
}
@Override
public void onNotificationAction(@NonNull NotificationAction action) {
// Here you can execute your own code before executing the default action of the notification
action.execute();
}
};);