Q: So our Flutter application uses the Pushwoosh Flutter plugin, but it also uses local notifications. I want both of them to use the same notification channel.
A: The easiest solution would be generating a channel for your local notifications using the same pattern Pushwoosh uses to create Channel names and Channel IDs.
The channel name is taken from "pw_channel" key in your push notification, so you should send a push with a channel name you have chosen for your local notifications. Then, please take a look at how channel IDs are generated:
private static final String CHANNEL_ID_PREFIX = "pushwoosh_";
static String channelId(String channelName) {
if (!channelName.contains(" ") && channelName.startsWith(CHANNEL_ID_PREFIX)) {
return channelName;
}
return CHANNEL_ID_PREFIX + channelName.trim().replaceAll("\\s+", "_").toLowerCase();
}
You should just send a correct value with "pw_channel" parameter, assign generated Channel ID to your local notifications and use the same Channel name for both notification types.
The other option might be using getNotificationChannels() method to get all the channels of the app and use the one you need. However please keep in mind that a push channel is generated after the first push to this channel is received.
Comments
0 comments
Please sign in to leave a comment.