notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
NotificationChannel channel = new NotificationChannel("leo", "测试通知", NotificationManager.IMPORTANCE_HIGH);
notificationManager.createNotificationChannel(channel);
}
Intent intent = new Intent(this, NotificationActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
leo = new NotificationCompat.Builder(this, "leo")
.setContentTitle("官方通知")
.setContentText("世界这么大,想去走走吗")
.setSmallIcon(R.drawable.baseline_person_24)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ceshi))
.setColor(Color.parseColor("#ff0000"))
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.build();
}