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

关于拓展模块NotificationStyle的demo运行时报错的问题

我使用的是demo程序进行测试,拓展程序链接:
App Inventor 2 NotificationStyle 拓展:个性化通知栏样式 · App Inventor 2 中文网

结果无论点什么按键都会报错:
edu.mit.appinventor.aicompanion3: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
注意: 5秒钟后将报告另一条错误信息。



网上说是版本不兼容什么的,听说有原生的Notification模块,但我好像没找到。

官方程序

--------------------------

这个提示来自 Android 12(API 31)及以上版本的系统,对 PendingIntent 的使用进行了更严格的要求:

错误信息翻译如下:
edu.mit.appinventor.aicompanion3:目标 API 版本为 S+(即 API 31 及以上)时,创建 PendingIntent 时必须指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 其中之一。强烈建议使用 FLAG_IMMUTABLE,只有当某些功能确实依赖于可变性(如行内回复、通知气泡等)时才使用 FLAG_MUTABLE。

解决方法:

你需要检查源码中涉及 PendingIntent 的创建部分,添加适当的 flag。例如:

原来可能是这样写的:PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

修改为:PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);

改造过的最新版,已经测试通过,请使用最新版本的aix拓展,或者最新的demo再试。
拓展文档页面进行下载:App Inventor 2 NotificationStyle 拓展:个性化通知栏样式 · App Inventor 2 中文网

原文:求助!关于拓展模块NotificationStyle的demo运行时报错的问题 - App Inventor 2 中文网 - 清泛IT社区,为创新赋能! 

http://www.dtcms.com/a/215110.html

相关文章:

  • 如何清除浏览器启动hao点360
  • 攻防世界RE-reverse_re3
  • 深入解析 BlockingQueue:并发编程面试中的高频考点!
  • vue3 浮点数计算
  • 架空线路智能云台监控系统介绍
  • ODBC简介
  • UNet 改进(28):结合Coordinate Attention+FPN架构
  • 字节开源 Dolphin: 通过异构锚点提示进行文档图像解析
  • 如何在 Windows 10 PC 上获取 iPhone短信
  • Ubuntu的shell脚本
  • 按键状态机
  • 深度学习算法模型概念整理----模型量化、校准、模型蒸馏、算子、算子融合
  • 第17章 发布和部署应用程序
  • ArcGIS Pro 3.4 二次开发 - 几何
  • Powershell实现服务守护进程功能(服务意外终止则重启)
  • LSTM模型进行天气预测Pytorch版本
  • 【EdgeYOLO】《EdgeYOLO: An Edge-Real-Time Object Detector》
  • Kubernetes Service 类型与实例详解
  • 阿里云国际版注册邮箱格式详解
  • MyBatis 拦截器的应用场景及实践
  • 矩阵链乘法问题
  • Vue:axios(POST请求)
  • 基于线性回归的短期预测
  • 5月26日复盘-自注意力机制
  • 如何提高 Python 代码质量
  • 56页 @《人工智能生命体 新启点》中國龍 原创连载
  • 小巧高效的目录索引生成软件
  • 大模型的检索增强生成综述研究
  • 消费电子卷入“技术军备竞赛”
  • 华为OD机试真题——二叉树的广度优先遍历(2025A卷:200分)Java/python/JavaScript/C/C++/GO最佳实现