当前位置: 首页 > news >正文

自助交友网站建设/semantic scholar

自助交友网站建设,semantic scholar,松江区建设交通委员会网站,深圳十大装修公司关于Android 的系统通知有时候会收不到的情况,如下给出一些兼容性的设置,代码如下: /** * 程序通知,覆盖start* 通知栏相关属性设置 */SuppressLint("NewApi")  private void setNotification() {NotificationManager…

关于Android 的系统通知有时候会收不到的情况,如下给出一些兼容性的设置,代码如下:

  /** * 程序通知,覆盖start* 通知栏相关属性设置 */@SuppressLint("NewApi")
  private void setNotification() {NotificationManager notificationManager = (NotificationManager) this.getSystemService(android.content.Context.NOTIFICATION_SERVICE);// 设置通知的事件消息CharSequence contentTitle = getString("标题"); // 通知栏标题CharSequence contentText = getString("内容"); // 通知栏内容 Intent notificationIntent = new Intent();notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);notificationIntent.setClass(this, MainActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);PendingIntent contentItent = PendingIntent.getActivity(this, 0, notificationIntent, 0);//以下针对不同版本的兼容设置if (android.os.Build.VERSION.SDK_INT > 11) {//notification.builderBuilder builder = new Notification.Builder(this); builder.setContentIntent(contentItent).setSmallIcon(R.drawable.ic_noti) //设置状态栏里面的图标(小图标)                     .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_notification))//下拉列表里面的图标(大图标)        .setTicker(contentText) //设置状态栏的显示的信息 .setWhen(System.currentTimeMillis()) //设置时间发生时间 .setAutoCancel(false) //设置可以清除 .setOngoing(true).setContentTitle(contentTitle) //设置下拉列表里的标题 .setContentText(contentText); //设置上下文内容 Notification notification = builder.getNotification(); notification.flags |= Notification.FLAG_ONGOING_EVENT; //将此通知放到通知栏的"Ongoing"即"正在运行"组中notification.flags |= Notification.FLAG_NO_CLEAR; //表明在点击了通知栏中的"清除通知"后,此通知不清除,经常与FLAG_ONGOING_EVENT一起使用notification.defaults = Notification.DEFAULT_LIGHTS;notificationManager.notify(0, notification);}else {Notification notification = new Notification(
         R.drawable.ic_notification, getString(R.string.app_name),System.currentTimeMillis());notification.flags
|= Notification.FLAG_ONGOING_EVENT; // 将此通知放到通知栏的"Ongoing"即"正在运行"组中notification.flags |= Notification.FLAG_NO_CLEAR; // 表明在点击了通知栏中的"清除通知"后,此通知不清除,经常与FLAG_ONGOING_EVENT一起使用notification.defaults = Notification.DEFAULT_LIGHTS;notification.setLatestEventInfo(this, contentTitle, contentText, contentItent);// 把Notification传递给NotificationManagernotificationManager.notify(0, notification);}}

 

转载于:https://www.cnblogs.com/fly-allblue/p/4000470.html

http://www.lbrq.cn/news/1332541.html

相关文章:

  • 彩票类网站怎么做推广/网站关键词查询网址
  • 企业建设网站意义/百度推广最简单方法
  • 中国铁建华南建设有限公司网站/网络项目推广平台
  • 做网站纸箱关键词/营销推广费用方案
  • 企业被网站收录/交换友情链接的途径有哪些
  • 鞍山外国网站制作/保定seo推广外包
  • 企业电话号码查询网站/南昌seo管理
  • 建设一家网站多少钱/福州seo招聘
  • WordPress分享到微博代码/seo关键词外包
  • 江西网站备案流程/推广运营
  • 舟山网站建设有限公司/最近一周的重大热点新闻
  • 网站做产品的审核工作怎么样/沈阳seo公司
  • 如何修改网站title/百度seo关键词
  • No物流网站建设/网站收录查询爱站
  • wordpress模板带后台/江苏搜索引擎优化
  • 做网站的集团/seo平台有哪些
  • 企业网站建设进什么科目核算/百度搜索资源平台提交
  • 网站建设 石景山/沈阳关键字优化公司
  • 简述建设一个网站的基本步骤/中国科技新闻网
  • 网站结构图怎么画/seo是如何优化
  • 郑州做网站哪个/万网官网域名查询
  • 百度58网络推广怎么做/提升神马seo关键词自然排名
  • 新手做网站怎么上传系统/成功的网络营销案例ppt
  • 猪八戒网站 怎么做兼职/广州百度seo优化排名
  • 在猪八戒网站如何做兼职/南宁百度快速优化
  • 怎么做转载小说网站/seo研究中心qq群
  • 网站建设优化一体/信息互联网推广
  • 网站加载很慢/怎样注册自己的网站
  • 哪个网站可以做英语语法题/云服务器
  • 视频网站建设的背景简介/外贸推广营销公司
  • 6 ABP 框架中的事件总线与分布式事件
  • Ansible 实操笔记:Playbook 与变量管理
  • 过程设计工具深度解析-软件工程之详细设计(补充篇)
  • 自然语言处理( NLP)基础
  • 网络基础设施保护
  • 从零开始手搓一个GPT大语言模型:从理论到实践的完整指南(一)