通知栏封装库,强大的通知栏工具类,链式编程调用,解决了8.0以上通知栏不显示问题,支持多种不同的使用场景,兼容老版本。还有自定义通知栏view,可高度定制布局……
通知栏封装库,强大的通知栏工具类,链式编程调用,解决了8.0以上通知栏不显示问题,支持多种不同的使用场景,兼容老版本。还有自定义通知栏view,可高度定制布局……
2.0 如何使用该库
implementation 'com.github.yangchong211.YCNotification:NotificationLib:1.0.4'
2.1 最简单调用方式
//这三个属性是必须要的,否则异常
NotificationUtils notificationUtils = new NotificationUtils(
this,"channel_1","通知1");
notificationUtils.sendNotification(1,
"这个是标题","这个是内容",R.mipmap.ic_launcher);
2.2 完整使用方法介绍
…
NotificationUtils notificationUtils = new NotificationUtils(this);
notificationUtils.setContent(getRemoteViews());
Notification notification = notificationUtils.getNotification("这个是标题4", "这个是内容4", R.mipmap.ic_launcher);
notificationUtils.getManager().notify(4,notification);
//清空特定渠道的通知
notificationUtils.clearNotificationChannel("channel");
//清空所有的通知
notificationUtils.clearAllNotification();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//判断通知是否是静默不重要的通知
boolean isNoImportance = notificationUtils.isNoImportance("channel_id");
//跳转设置中心
notificationUtils.openChannelSetting("channel_id");
}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
No open issues yet, or sync has not completed.