`
Leif_冬
  • 浏览: 44632 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

android 8.0 Notification

阅读更多
private void updateSuccessNotification(boolean isPass){
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
            String id = "update_success";
            String name = "update_success_notification";
            NotificationManager notificationManager = (NotificationManager) mSystemContext.getSystem
Service(NOTIFICATION_SERVICE);
            Notification notification = null;
            NotificationChannel mChannel = null;
            mChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW);
            notificationManager.createNotificationChannel(mChannel);
            if(isPass) {
                notification = new Notification.Builder(mSystemContext)
                        .setChannelId(id)
                        .setContentTitle(mSystemContext.getString(R.string.global_update_success))
                        .setContentText(mSystemContext.getString(R.string.global_current_version)+Bu
ild.VERSION.INCREMENTAL)
                        .setSmallIcon(R.drawable.btn_default).build();
                notificationManager.notify(111123, notification);
            }else{	
                notificationManager.createNotificationChannel(mChannel);
                notification = new Notification.Builder(mSystemContext)
                        .setChannelId(id)
                        .setContentTitle(mSystemContext.getString(R.string.global_update_fail))
                        .setContentText(mSystemContext.getString(R.string.global_current_version)+Bu
ild.VERSION.INCREMENTAL)
                        .setSmallIcon(R.drawable.btn_default).build();
                notificationManager.notify(111123, notification);
            }	
			        }	
    }

 

分享到:
评论

相关推荐

    android 8.0 notification 写法

    android 8.0 对 通知栏有了很大的改变,以往的方法写通知栏会报错,google新加了一个notificationChannel,而且必须添加,这里是Demo。

    Android 8.0 Notification 写法Example

    Android 8.0 Notification 写法Example

    Android 8.0通知栏(Notification)适配

    这几天做一个小软件在API28(Android 9.0)的模拟器上测试时,发现通知栏无效,经过一番查询,了解到:API26(Android 8.0)以后,引入了**通知渠道(Notification Channels)**这么一个东西来帮助用户管理通知。...

    Android 8.0 各种通知写法

    Android 8.0中各种通知写法汇总 https://blog.csdn.net/lj19851227/article/details/81013605

    Android 8.0系统通知栏适配Demo

    此为示例代码,详细文章请参考 https://blog.csdn.net/guolin_blog/article/details/79854070

    Android 8.0实现发送通知

    在Android8.0以后,针对Notification 通知api做了修改,新增了通知渠道(NotificationCannel)。下面就把demo的详细代码记录下: 1.Application 为NotificationManager添加通知频道 import android.app.Application;...

    阿里百川 IM SDK,经修改适配Android8.0

    阿里百川 IM SDK,经修改适配Android8.0,因为其中有用到Notification,但是因为没有创建channid,所以在Android8.0的手机上运行,IM SDK创建的新进场会崩溃,导致IM SDK 不能正常运行

    Android 8.0系统中通知栏的适配详解

    大家好,今天我们继续来学习Android 8.0系统的适配。 之前我们已经讲到了,Android 8.0系统最主要需要进行适配的地方有两处:应用图标和通知栏。在上一篇文章当中,我们学习了Android 8.0系统应用图标的适配,还没有...

    Android通知Notification汇总

    notification是一种出现在任务栏的提示,特别是在4.0以后notification改进了不少,本文内容都是基于4.0及4.1以后总结来的,详细介绍各种布局的Notification样式,实现音乐播放器、邮件通知等复杂的例子详细代码。

    Android 8.0 compatibility list

    Notification Listener Service 3.8.3.3. DND (Do not Disturb) 3.8.4. Search 3.8.5. Alerts and Toasts 3.8.6. Themes 3.8.7. Live Wallpapers 3.8.8. Activity Switching 3.8.9. Input Management 3.8.10. Lock ...

    Android-Notification(兼容8.0+以及8.0以下).zip

    Android Notification(兼容8.0+以及8.0以下),博客:https://blog.csdn.net/Crystal_xing/article/details/103159161

    android 8.0新特性与开发指南

    Android O 新特性一介绍以及开发指南 通知渠道 — Notification Channels 通知渠道是由应用自行定义的通知内容类别,借助渠道,开发者可以让用户对不同种类的通知进行精细控制,用户可以单独拦截或更改每个渠道的...

    Android8.0适配前台定位服务service的示例代码

    从Android 8.0开始系统为实现降低功耗,对后台应用获取用户位置信息频率进行了限制,每小时只允许更新几次位置信息,详细信息请参考官方说明。按照官方指引,如果要提高位置更新频率,需要后台应用提供一个前台服务...

    Notification80.rar

    android 8.0 通知栏Notification适配、

    详解Android 8.0以上系统应用如何保活

    最近在做一个埋点的sdk,由于... JobScheduler(Android 5.0后引入,8.0后失效) 1 像素activity保活方案(不推荐) 广播锁屏、自定义锁屏(不推荐) 第三方推送SDK唤醒(效果好,缺点是第三方接入) 下面是具体的

    notification.java

    结合Android8.0 9.0 之后关于notification创建和显示的适配要求,整合适配任意Android版本

    Notification通知的使用

    Notification通知的使用,介绍了Android 8.0在通知方面的改进,还有通知相关的使用方法。

    SystemNotificationDemo.zip

    Android 8.0 及以上 Notification 的适配代码,案例中包含了普通样式的通知、自定义View样式的通知、带进度条的通知、以及悬浮式通知。

    Android代码-YCNotification

    1.2 关于8.0以上通知栏问题,一定要适配吗Android8.0通知栏吗? Google这次对于8.0系统通知渠道的推广态度还是比较强硬的。如果你将项目中的targetSdkVersion指定到了26或者更高,那么Android系统就会认为你的App...

    BroadCastAndNotificationDemo

    BroadCastReceiver、Notification简单使用,以及8.0的Notification Channel问题

Global site tag (gtag.js) - Google Analytics