Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active Apr 29, 2020
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
Copy link

ritikrishu commented Apr 13, 2018

Line number 10 should be setChannelId

@yikeLiuAde
Copy link

yikeLiuAde commented Apr 29, 2020

Hi, the notifyId is never used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment