知识养成了思想,思想同时又在融化知识。这篇文章主要讲述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可用)】
推荐阅读
- Android面试之HashMap的实现原理
- android 一步一步教你集成tinker(热修复)
- call和apply;this;闭包
- 社群系统ThinkSNS+第4阶段安卓端更新播报
- NetApp配置NetApp控制器与Linux NTP服务器同步
- Android Studio无法打印Logout日志
- github版本控制 android studio
- (转 )Android那些高逼格的写法InvocationHandler与代理模式
- POST方式"Content-type"是"application/x-www-form-urlencoded 的请求遇到的问题