通知的基本创建方式
private void sendNotification(){
int notificationId = 222;
String channelId = "channel_name";
String channelName = getPackageName();
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_HIGH);
manager.createNotificationChannel(channel);
Notification.Builder builder =new Notification.Builder(this, channelId);
builder.setContentText("This is Content Text");
builder.setContentTitle("This is title");
builder.setChannelId(channelId);
builder.setColor(Color.GREEN);
builder.setSmallIcon(R.drawable.ic_launcher_background);
Notification notification = builder.build();
manager.notify(notificationId, notification);
}