Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active April 29, 2020 15:50
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 hitherejoe/01d9a4842225fc58a4bfc984a6845eef to your computer and use it in GitHub Desktop.
Save hitherejoe/01d9a4842225fc58a4bfc984a6845eef to your computer and use it in GitHub Desktop.
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

Line number 10 should be setChannelId

@yikeLiuAde
Copy link

Hi, the notifyId is never used

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