Skip to content

Instantly share code, notes, and snippets.

@hitherejoe hitherejoe/SendNotification.java Secret
Last active Apr 13, 2018

Embed
What would you like to do?
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int notifyId = 1;
String channelId = "some_channel_id";
Notification notification = new Notification.Builder(MainActivity.this)
.setContentTitle("Some Message")
.setContentText("You've received new messages!")
.setSmallIcon(R.drawable.ic_notification)
.setChannel(channelId)
.build();
notificationManager.notify(id, notification);
@ritikrishu

This comment has been minimized.

Copy link

ritikrishu commented Apr 13, 2018

Line number 10 should be setChannelId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.