Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
Y

YCNotification

> 编程语言
Open source

通知栏封装库,强大的通知栏工具类,链式编程调用,解决了8.0以上通知栏不显示问题,支持多种不同的使用场景,兼容老版本。还有自定义通知栏view,可高度定制布局……

379 stars0 likes0 views
WebsiteGitHub

About

通知栏封装库,强大的通知栏工具类,链式编程调用,解决了8.0以上通知栏不显示问题,支持多种不同的使用场景,兼容老版本。还有自定义通知栏view,可高度定制布局……

目录介绍

  • 01.该库具有的优势
  • 02.使用方法介绍
  • 03.通知栏深度解析
  • 04.图片展示
  • 05.版本更新日志
  • 06.关于其他

01.该库具有的优势

  • 1.1 链式调用,支持设置多种属性。同时解决了8.0以上通知栏不显示问题。
  • 1.2 关于8.0以上通知栏问题,一定要适配吗Android8.0通知栏吗?
    • Google这次对于8.0系统通知渠道的推广态度还是比较强硬的。如果你将项目中的targetSdkVersion指定到了26或者更高,那么Android系统就会认为你的App已经做好了8.0系统的适配工作,当然包括了通知栏的适配。这个时候如果还不使用通知渠道的话,那么你的App的通知将完全无法弹出。因此这里给大家的建议就是,一定要适配。
    • 你也可以直接使用我这个工具类,测试,是可行的
  • 1.3 Notification通知栏用法介绍及部分源码解析,请看这篇博客【郭霖公众号授权推荐】:https://blog.csdn.net/m0_37700275/article/details/78745024

02.使用方法介绍

  • 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 完整使用方法介绍

…
  • 2.3 如果你想获取Notification对象,自己发送消息也可以
    NotificationUtils notificationUtils = new NotificationUtils(this);
    notificationUtils.setContent(getRemoteViews());
    Notification notification = notificationUtils.getNotification("这个是标题4", "这个是内容4", R.mipmap.ic_launcher);
    notificationUtils.getManager().notify(4,notification);
    
  • 2.4 如何清除所有通知
    //清空特定渠道的通知
    notificationUtils.clearNotificationChannel("channel");
    //清空所有的通知
    notificationUtils.clearAllNotification();
    
  • 2.5 其他到一些api说明
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        //判断通知是否是静默不重要的通知
        boolean isNoImportance = notificationUtils.isNoImportance("channel_id");
        //跳转设置中心
        notificationUtils.openChannelSetting("channel_id");
    }
    

04.图片展示

05.版本更新日志

  • v1.0.0 更新于2017年3月9日
  • v1.0.1 更新于2017年7月18日
  • v2.0.0 更新于2018年11月20日

关于其他内容介绍

关于博客汇总链接

  • 1.技术博客汇总
  • 2.开源项目汇总
  • 3.生活博客汇总
  • 4.喜马拉雅音频汇总
  • 5.其他汇总

关于LICENSE

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言