Skip to content

Instantly share code, notes, and snippets.

@markojerkic
Created April 1, 2017 15:26
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 markojerkic/b84b8e3de43600852da5650665ddab89 to your computer and use it in GitHub Desktop.
Save markojerkic/b84b8e3de43600852da5650665ddab89 to your computer and use it in GitHub Desktop.
The final look at the simple notification app
public void sendNotification() {
//builds the basic notification
NotificationCompat.Builder mNotification =
(NotificationCompat.Builder) new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_info_outline_white_24px)
.setContentTitle("First Notificaion")
.setContentText("Hi!");
//sets the sound, vibration and other things to
//your device's defaults
mNotification.setDefaults(Notification.DEFAULT_ALL);
NotificationManager mNotfMng =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//sends the notification
mNotfMng.notify(001, mNotification.build());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment