Skip to content

Instantly share code, notes, and snippets.

@Adamwaheed
Created January 3, 2016 15:55
Show Gist options
  • Save Adamwaheed/f9aa61a1a4689860948c to your computer and use it in GitHub Desktop.
Save Adamwaheed/f9aa61a1a4689860948c to your computer and use it in GitHub Desktop.
Intent intent = new Intent();
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this,0,intent,0);
Notification noti = new Notification.Builder(MainActivity.this)
.setTicker("Title")
.setContentTitle("Contant Tutle")
.setContentText("Hekko this is nust")
.setContentText("Content Texty")
.setSmallIcon(android.R.drawable.menu_frame)
.setContentIntent(pendingIntent).getNotification();
noti.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
nm.notify(0,noti);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment