Skip to content

Instantly share code, notes, and snippets.

@sfmc-mobilepushsdk
Last active October 2, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfmc-mobilepushsdk/69f3ce1be80000b0b183371a3b1c59ed to your computer and use it in GitHub Desktop.
Save sfmc-mobilepushsdk/69f3ce1be80000b0b183371a3b1c59ed to your computer and use it in GitHub Desktop.
final String channelId = "my_custom_channel";
((android.app.NotificationManager) getSystemService(
Context.NOTIFICATION_SERVICE)).createNotificationChannel(
new NotificationChannel(channelId, "Marketing Messages",
android.app.NotificationManager.IMPORTANCE_DEFAULT));
MarketingCloudSdk.init((Context) this, MarketingCloudConfig.builder()
// Other configuration options
.setNotificationCustomizationOptions(
NotificationCustomizationOptions.create(R.drawable.ic_notification_icon, null,
new NotificationManager.NotificationChannelIdProvider() {
@Override @NonNull public String getNotificationChannelId(@NonNull Context context,
@NonNull NotificationMessage notificationMessage) {
// Whatever custom logic required to determine which channel should be used for the message.
return channelId;
}
})).build((Context) this), new MarketingCloudSdk.InitializationListener() {
@Override public void complete(@NonNull InitializationStatus status) {
// TODO Handle initialization status
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment