Skip to content

Instantly share code, notes, and snippets.

@lopspower
Last active October 10, 2017 01:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lopspower/f8ebb17178ccd58aefe4 to your computer and use it in GitHub Desktop.
Save lopspower/f8ebb17178ccd58aefe4 to your computer and use it in GitHub Desktop.
Notification with overview

Notification with overview

Twitter

How to implement Android Notification with overview like WhatsApp?

The basic Notification implementation this way:

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, 
    new Intent(this, MainActivity.class), 0);

Notification notification = new Notification.Builder(this)
                .setContentTitle("Title")
                .setContentText("Message")
                .setSmallIcon(R.drawable.ic_notif)
                .setContentIntent(mPendingIntent)
                .build();

NotificationManager notificationManager = 
    (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(1, notification);

But in that case, I don't have the overview. I only have a small icon in the notification bar:

Finaly, it's just about a Priority level:

notificationBuilder.setPriority(Notification.PRIORITY_HIGH);

📚 Best Android Gists

You can see other best Android Gists or offer your just here https://github.com/lopspower/BestAndroidGists 👍.

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