首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏葬爱家族

    Android Notification

    使用通知的时候,需要创建一个Notification对象用来承载通知的内容,但是一般不会直接通过Notification的构造方法来得到对象,而是使用它的内部类Notification.Builder来实例化一个 Builder对象,并设置通知的各项属性,最后通过Notification.Builder.builder()方法得到一个Notification对象,当获得这个Notification对象之后,就可以使用 ); Notification notification = new Notification.Builder(this) .setSmallIcon(R.drawable.icon_small , notification); NOTIFICATION_ID是一个自己定义值,一个id表示一个notification,如果两次发出的notification是相同的id,那就会更新之前的那一个,这是 (Context.NOTIFICATION_SERVICE); Notification notification = new Notification.Builder(this) .setSmallIcon

    2K20发布于 2018-09-05
  • 来自专栏陶士涵的菜地

    notification入门

    调用NotificationManager对象的notify()方法,发送通知,参数:id是0,Notification对象 获取Builder对象,通过new Notification.Builder setLargeIcon的参数:Bitmap对象,BitmapFactory.decodeResource(),参数:getResoure(),资源id 调用Builder对象的build()方法,得到Notification 对象 此时会报一些错误,最低兼容版本是11,我们直接加一个注释屏蔽掉错误”NewApi” 在低版本的手机上,上面的代码会出错 获取Notification对象,通过new出来,参数:资源id,文本,时间 调用Notification对象的setLastEventInfo()方法,设置最新消息,参数:上下文,文本,PendingIntent对象 设置Notification对象的flags属性为Notification.FLAG_AUTO_CANCEL ); Notification.Builder builder=new Notification.Builder(this); Notification notification

    68830发布于 2019-09-10
  • 来自专栏后端技术

    notification通知栏

    p/92afa56aee05 代码案例 private void initBuilder(Context context, String title) { builder = new Notification.Builder

    80140发布于 2019-05-25
  • 来自专栏深入理解Android

    全面解析Notification

    Notification在Android中使用的频率可以说是非常高的,本篇博客,我将围绕着Notification的各方面进行解析,使大家对Notification有更好的认识。 ); mNotificationManager.notify(id, notification); Notification重要方法解析 Notification 的基本操作主要有创建、更新、取消这三种 Notification notification = mBuilder.build(); 2. notification.flags = Notification.FLAG_AUTO_CANCEL (优先级为0) Notification.PRIORITY_HIGH Notification.PRIORITY_LOW Notification.PRIORITY_MAX(优先级为2) Notification.PRIORITY_MIN notification.contentView = remoteViews; 折叠式Notification完整代码: Notification.Builder builder = new Notification.Builder

    3.4K30编辑于 2022-06-22
  • 来自专栏Android、鸿蒙开发

    Android Notification使用

    正文   通知的使用的内容还是比较多的,此篇文章将会尽可能详细的介绍Notification的内容。 一、Android中通知的变化 1. 部分与通知行为相关的 API 已从 Notification 移至 NotificationChannel。 : Notification //通知Id private val notificationId = 1   发送通知首先要通过通知服务得到通知管理者,在onCreate方法中增加如下代码 ① 创建目的Activity   我们在com.llw.notification下创建DetailsActivity,对应activity_details.xml布局文件,修改一下布局文件,代码如下: 其实很简单,首先我们同样要定义一个大一点同通知布局,在layout下新建一个layout_custom_notification_big.xml,代码如下: <?

    3.4K20编辑于 2022-07-12
  • 来自专栏玄魂工作室

    (Notification) 桌面通知

    = new Notification('标题'); notification.onshow = function () { setTimeout(function () { notification.close ') { var notification = new Notification('弹窗'); } }); Notification.close() 通知框关闭 function notify() { ("Notification"in window)) { alert("This browser does not support desktop notification"); return; } if (Notification.permission ==="granted") { var notification = new Notification("Hi there!") ) { if (permission ==="granted") { var notification = new Notification("Hi there!")

    1.6K50发布于 2018-04-11
  • 来自专栏算法微时光

    HooK之hook Notification

    image.png 目录 第一章:android hook介绍 第二章:hook之替换View.OnClickListener 第三章:HooK之hook Notification HooK Notification my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH); NotificationCompat.Builder notification 继续跟踪notify方法: public void notify(int id, Notification notification) { notify(null, id, notification ); } public void notify(String tag, int id, Notification notification) { notifyAsUser(tag, id, notification notification, UserHandle user) { INotificationManager service = getService(); String

    1.5K20发布于 2021-02-05
  • 来自专栏水击三千

    Android学习之Notification

    Notification可以在手机的状态栏发出一则通知,它需要用NotificationManager来管理,实现Notification其实很简单。 ); 2.创建一个notification对象。 每一个notification对象都是唯一的,一般通过资源id进行标示。这里需要定义通知的内容、时间、以及显示的图像。 Notification notification=new Notification(resid,ticktext,System.currentTimeMillis()); 3.Notification notificationmanager.notify(id,notification);

    1K90发布于 2018-02-27
  • 来自专栏码农的生活

    Notification的简单使用

    Notification不同版本的使用 //RemoteViews是Notification的内部布局 RemoteViews rv = new RemoteViews(getPackdgeName( 的图片 rv.setProgressBare(R.id.notiProgressbar, 100, 0, false); Notification notification = new Notification ();//过时版本的写法 notification.tickerText = "开始下载"; notification.icon = R.drawable.ic_laucher; //必须加上此处,否则后面的 RemoteViews不起作用 notification.flag = Notification.FLAG_AUTO_CANCEL; //点击完后自动清除 PendingIntent pendingIntent notification = new Notification.Builder(this).setContentIntent(pendingIntent).setContentTitle("下载完成"

    76020发布于 2021-10-29
  • 来自专栏日常技术分享

    iOS Silent Remote Notification

    Silent Remote Notifications 推送唤醒,静默推送 Silent Remote Notification 的用处 推送唤醒: 静默推送只能在应用在前台和应用在后台挂起时执行,也就是说

    1.1K20编辑于 2022-03-23
  • 来自专栏james大数据架构

    Android之Notification介绍

    Notification就是在桌面的状态通知栏。这主要涉及三个主要类: Notification:设置通知的各个属性。 NotificationManager:负责发送通知和取消通知 Notification.Builder:Notification内之类,创建Notification对象。 ; 二、Notification 设置这个类主要是设置Notification的相关属性。 初始化 Notification n = new Notification(); Notification里面有很多属性下面选择几个常用的介绍一下 icon  这个是设置通知的图标。 这个类一般用于管理Notification,动态的设置Notification的一些属性。

    1.4K70发布于 2018-01-22
  • 来自专栏韩曙亮的移动开发专栏

    【错误记录】前台进程报错 ( Bad notification for startForeground invalid channel for service notification )

    就不显示已通知了 , 但是 oom_adj 值会变成后台进程 11 // 设置 ID 为 1 , 会在通知栏显示该前台服务 startForeground(1, new Notification main Process: kim.hsl.keep_progress_alive, PID: 23830 android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification .setPriority(PRIORITY_MIN) .setCategory(Notification.CATEGORY_SERVICE) .build(); startForeground(1, notification); } /** * 创建通知通道 * @param channelId

    2.3K40编辑于 2023-03-29
  • 来自专栏码客

    Android Notification的用法

    (service); notification = new Notification(); // 通知提示 String tickerText = "状态栏上显示的消息"; // 显示时间 long = tickerText; // 显示在状态栏中的文字 notification.when = when; // 设置来通知时的时间 notification.ledARGB = 0xff00ff00 ; // 点击清除按钮或点击通知后会自动消失 notification.flags |= Notification.FLAG_AUTO_CANCEL; // 设置默认铃声 notification.defaults = Notification.DEFAULT_SOUND; // 设置铃声震动 notification.defaults = Notification.DEFAULT_ALL; // 单击通知后会跳转到 notification = builder.build(); nManager.notify(1, notification);

    88420发布于 2019-10-22
  • 来自专栏前端基础

    Web Notification桌面推送消息

    Notification API 才会生效。 Notification.permission Notification.permission 是 Notification 的静态属性,代表通知权限的授权状态,取值包括:、 granted: === 'undefined') { console.log(`浏览器不支持 Notification`) return } if (Notification.permission === 'denied') { console.log(`Notification 权限已被禁用`) return } if (Notification.permission === 'granted') { console.log(`Notification 可用`) } else { Notification.requestPermission(

    2.2K20发布于 2020-04-30
  • 来自专栏吴小龙同學

    Android 9.0 SystemUI Notification

    本文主要分享 SystemUI Notification 具体如何呈现的?基于 AOSP 9.0 分析。 概述 ? UnsupportedAppUsage public void notifyAsUser(String tag, int id, Notification notification, UserHandle Notification.addFieldsFromContext(mContext, notification); if (notification.sound ! ("Invalid notification (no valid small icon): " + notification); } } if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")"); notification.reduceImageSizes

    3.2K31发布于 2020-10-30
  • 来自专栏黄啊码【CSDN同名】

    Android Notification消息提示

    一般而言,消息提示,可以通过Toast方式,提醒给用户看,而通过Notification方式的话,可以在状态栏显示出来。 对象 Notification m_Notification; void showNotification(){ //初始化NotificationManager 对象 m_Notification = new Notification(); //设置通知在状态栏显示的图标 m_Notification.icon "; //通知时发出默认的声音 m_Notification.defaults = Notification.DEFAULT_SOUND; //设置通知显示的参数 当然也可以去除该Notification.

    1K10发布于 2020-05-29
  • 来自专栏向治洪

    android notification,notificationmanager详解

    .setContentTitle("Notification Title") .setContentText("This is the notification .setContentTitle("Notification Title") .setContentText("This is the notification );获取NotificationNotificationManager 消息管理类, 2,创建Notification实体 通过Notification.Builder builder = new Notification.Builder notification = builder.build(); //指定展开时的视图 notification.bigContentView = remoteViews ; notificationManager.notify(1, notification); 自定义通知 Notification.Builder builder = new Notification.Builder

    1.9K70发布于 2018-02-05
  • 来自专栏全栈程序员必看

    preference用法for_notification用法

    在Android3.0之前,设置界面使用PreferenceActivity,在Android3.0之后,官方推荐使用PreferenceFragment,对应于碎片化技术。

    4.1K10编辑于 2022-10-04
  • 来自专栏移动开发面面观

    Flutter Notification使用说明

    所幸,Flutter的Notification为我们提供了这样的能力。 使用方法 创建Notification class TestNotification extends Notification { TestNotification({ @required 我们先来看看Notification的实现。 Notification的实现非常简单,阅读源码时实属福利。 这里值得注意的是,只有当我们notification返回true时,遍历才会终止。 以上就是Flutter中Notification的基本原理和使用方法。

    1.7K30发布于 2020-02-25
  • 来自专栏我的博客

    Laravel :notification使用笔记

    php artisan make:notification PayFinish php artisan notifications:table 创建通知表 //TestModel namespace app user = TestModel::find(1); //$user->notify(new PayFinish($user)); foreach ($user->notifications as $notification ) { print_r($notification->data); } foreach ($user->unreadNotifications as $notification) { print_r($ notification->data); //$notification->markAsRead();//标记已读 } //Notification::send($user, new PayFinish

    1.2K50发布于 2018-04-28
领券