android 通知(android 8.0可用)

知识养成了思想,思想同时又在融化知识。这篇文章主要讲述android 通知(android 8.0可用)相关的知识,希望能为你提供帮助。

final String CHANNEL_ID = "channel_id_1"; final String CHANNEL_NAME = "channel_name_1"; NotificationManager mManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification.Builder builder = null; if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O){ builder = new Notification.Builder(this); }else{ NotificationChannel notificationChannel = new NotificationChannel(Config.CHANNEL_ID, Config.CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH); //如果这里用IMPORTANCE_NOENE就需要在系统的设置里面开启渠道, //通知才能正常弹出mManager.createNotificationChannel(notificationChannel); builder = new Notification.Builder(this,Config.CHANNEL_ID); }notification = builder.build(); mManager.notify(555, notification);

【android 通知(android 8.0可用)】 

    推荐阅读