一、Notitfcation 通知
1、交互式的通知
NotificationManager manager1 = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder1 = new Notification.Builder(this);
builder1.setSmallIcon(R.mipmap.ic_launcher);
builder1.setContentTitle("这是标题");
builder1.setContentText("这是内容部分");
builder1.setPriority(Notification.PRIORITY_MAX);
builder1.setDefaults(Notification.DEFAULT_ALL);
builder1.setAutoCancel(true);
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder1.setContentIntent(pendingIntent);
Notification build1 = builder1.build();
manager1.notify(1, build1);
2、发送大图或列表通知
NotificationManager manager2 = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder2 = new Notification.Builder(this);
builder2.setSmallIcon(R.mipmap.ic_launcher);
builder2.setContentTitle("这是标题");
builder2.setPriority(Notification.PRIORITY_MAX);
builder2.setDefaults(Notification.DEFAULT_ALL);
Notification.BigPictureStyle bigPictureStyle = new Notification.BigPictureStyle();
bigPictureStyle.bigLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round