Skip to content

Instantly share code, notes, and snippets.

@sharifulislam52
Last active March 1, 2018 15:22
Show Gist options
  • Save sharifulislam52/88ce8dc63660d864799f3912e3f44ca4 to your computer and use it in GitHub Desktop.
Save sharifulislam52/88ce8dc63660d864799f3912e3f44ca4 to your computer and use it in GitHub Desktop.
Intent intent = new Intent();
PendingIntent my_pIntent = PendingIntent.getActivities(your_activity.this,
0, new Intent[]{intent},0);
Notification mynoti = new Notification.Builder(your_activity.this)
.setTicker("Ticker_Text")
.setContentTitle("Content_Title")
.setContentText("Content_Text")
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(my_pIntent).getNotification();
mynoti.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager notiManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notiManager.notify(0,mynoti);
// my_pIntent, your_activity, mynoti, Ticker_Text, Content_Title, Content_Text, ic_launcher, notiManager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment