channelName
Customizes the display name of a notification channel.
On Android 8.0 (API 26) and higher, notifications are organized into channels that users can manage in system settings. Override this method to provide user-friendly channel names based on the channel identifier sent in the push payload.
The channel name appears in the notification settings UI where users control notification behavior. Choose clear, descriptive names that help users understand what notifications they'll receive in each channel.
Note: Returning an empty string will cause the SDK to use the default channel name. Channel names cannot be changed after the channel is created. Example - Map channel IDs to friendly names:
public String channelName(String channelName) {
// channelName comes from "pw_channel" in push payload
switch (channelName) {
case "orders":
return "Order Updates";
case "promotions":
return "Deals and Offers";
case "urgent":
return "Urgent Notifications";
default:
return "General Notifications";
}
}
public String channelName(String channelName) {
Context context = getApplicationContext();
if ("orders".equals(channelName)) {
return context.getString(R.string.channel_orders);
} else if ("promotions".equals(channelName)) {
return context.getString(R.string.channel_promotions);
}
return context.getString(R.string.channel_default);
}
Return
User-friendly name to display in notification settings. Empty string will beignored and the default channel name will be used
Parameters
Channel identifier from the push payload's "pw_channel" attribute,or the default channel name if not specified