no-translate

Change push notifications' icons and texts

Make your push notifications as beautiful as a rose.
Napisany przez Alex
Zaktualizowano 6 miesięcy temu

You can customize the look of push notifications sent by the HelpCrunch Android SDK by changing the notification icon and text.

Customize the color, icons, text and style of notifications:

...or like this:

You can do all this with HCNotificationsTheme.Builder

//App.java (extends Application)

//Customize notification avatar
HCAvatarTheme avatarTheme = new HCAvatarTheme.Builder()
                .setPlaceholderBackgroundColor(R.color.hc_color_code_bg_outcoming_dark)
                .setPlaceholderTextColor(android.R.color.white)
                .build();

//Customize notification theme
HCNotificationsTheme notificationsTheme = new HCNotificationsTheme.Builder()
                .setAvatarTheme(avatarTheme)
                .setChannelTitleRes(R.string.app_name)
                .setChannelTitle("Lorem Support") //or use String value
                .setSmallIconRes(R.drawable.ic_favicon)
                .setMessagesCounterEnabled(false)
                .setColor(Color.parseColor("#4c82f8"))
                .build();

//Get Default theme template to change only notification's theme
HCTheme theme = new HCTheme.Builder(HCTheme.DEFAULT)
                .setNotificationsTheme(notificationsTheme)
                .build();

HCOptions options = new HCOptions.Builder()
                .setTheme(theme)
                .build();

HelpCrunch.initialize(
                this,
                ORGANISATION,
                APP_ID,
                SECRET,
                null,
                options
);

Czy odpowiedzieliśmy na Twoje pytanie?