简体   繁体   中英

How to implement Android Notification with overview like WhatsApp?

I want to implement a notification with overview when the device is in use like WhatsApp:

在此处输入图片说明

I know the basic 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:

简单通知

最后,大约是一个优先级

notificationBuilder.setPriority(Notification.PRIORITY_HIGH);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM