`

Background execution not allowed

阅读更多
11-05 10:08:18.058   673   736 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.TEST flg=0x400010 } to mvp.com.presentationapp/.PresentationScreenReceiv
er

在Android O上处于安全的考虑,google不允许广播隐试intent了。可以查看源码http://androidxref.com/8.1.0_r33/xref/frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java#1275

267                    } else if (((r.intent.getFlags()&Intent.FLAG_RECEIVER_EXCLUDE_BACKGROUND) != 0)
1268                            || (r.intent.getComponent() == null
1269                                && r.intent.getPackage() == null
1270                                && ((r.intent.getFlags()
1271                                        & Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND) == 0)
1272                                && !isSignaturePerm(r.requiredPermissions))) {
1273                        mService.addBackgroundCheckViolationLocked(r.intent.getAction(),
1274                                component.getPackageName());
1275                        Slog.w(TAG, "Background execution not allowed: receiving "
1276                                + r.intent + " to "
1277                                + component.flattenToShortString());
1278                        skip = true;
1279                    }
1280                }
1281            }


我们可以为Intent加上FLAG_RECEIVER_INCLUDE_BACKGROUND(0x01000000) 这个标志位

通过adb shell am broadcast -a android.intent.action.TEST -f 0x01000000来验证:
11-05 10:08:28.042  1480  1480 E PresentationScreenReceiver: onReceive: android.intent.action.TEST false

分享到:
评论

相关推荐

    background-execution-commands.rar_execution_rontab

    本压缩包文件"background-execution-commands.rar_execution_rontab"聚焦于如何在Linux系统中实现后台执行命令,包括使用`crontab`、`at`、后台运行以及`nohup`命令。 首先,`crontab`是Linux系统中的一个非常重要...

    Android代码-cordova-plugin-background-mode

    Plugin for the Cordova framework to perform infinite background execution. Most mobile operating systems are multitasking capable, but most apps dont need to run while in background and not present ...

    react-native-background-execution-ios:React iOS的本机后台执行管理

    yarn add react-native-background-execution-ios 自动连结 react-native link react-native-background-execution-ios 手动链接 在XCode的项目导航器中,右键单击“ Libraries ➜ Add Files to [your project's ...

    Manufacturing Execution System MES

    Manufacturing Execution Systems – MES Dr.-Ing. Jürgen Kletti Springer Berlin Heidelberg PDF 英文版。解释、建构 MES,最后其中一章谈到与SAP 集成,和塑料加工行业MES 应用。 专门谈 MES 的书其实不多,这本...

    Intellij IDEA实现springboot热部署过程解析

    转到`File -> Settings -> Build, Execution, Deployment -> Compiler`,找到`Build project automatically`选项并勾选。这样,每当代码发生变化时,IDEA就会自动进行编译。 2. **启用Registry中的热部署配置**: ...

    东信和平测试平台Execution v5.0

    "东信和平测试平台Execution v5.0"是一款在行业内具有较高知名度的自动化测试工具,专为运营商设计,用于执行脚本级别的测试任务。这款平台的强大之处在于它支持ECN加密脚本和JavaScript脚本,这使得测试人员能够...

    JBPM4中ProcessDefinition、ProcessInstance、Execution、Task关系和区别

    JBPM4 中 ProcessDefinition、ProcessInstance、Execution、Task 关系和区别 ProcessDefinition 是流程的定义,也可以理解为流程的规范。它有一个 id,这个 id 的格式为 {key}-{version},其中 key 和 version 之间...

    eager_execution_execution_eagerexecution_tensorflow_

    在TensorFlow库中,Eager Execution是一种立即执行的模式,与传统的图模式(Graph Mode)形成对比。在Eager Execution模式下,TensorFlow的操作会立即评估并返回结果,无需构建计算图并单独运行它。这使得开发过程...

    Hardware_Accelerated_Execution_Manager.zip

    用以解决androidatudio虚拟机因未装haxm而无法运行的情况: 将intelhaxm-android文件放入..sdk\extras\intel\Hardware_Accelerated_Execution_Manager文件下,然后手动运行intelhaxm-android文件。

    MES珍藏宝典:Manufacturing Execution Systems (MES)

    ### MES珍藏宝典:Manufacturing Execution Systems (MES) 相关知识点 #### 一、Manufacturing Execution Systems (MES) 概述 Manufacturing Execution Systems(MES),即制造执行系统,是工业自动化与信息化领域...

    Hardware_Accelerated_Execution_Manager

    《Android模拟器硬件加速:Hardware_Accelerated_Execution_Manager详解》 在移动应用开发领域,Android模拟器扮演着至关重要的角色,它为开发者提供了一个在桌面系统上测试应用程序的平台,无需实际设备。然而,...

    execution表达式&切入点表达式.txt

    在使用spring框架配置AOP的时候,不管是通过XML配置文件还是注解的方式都需要定义pointcut"切入点

    VAL2.rar_Symbolic execution_execution

    《深入理解Symbolic Execution与Execution在Java环境中的应用——基于Symstra框架的C代码解析》 在计算机科学领域,符号执行(Symbolic Execution)是一种强大的软件分析技术,它能够帮助我们理解和验证程序的行为...

    Manufacturing Execution Systems - MES

    #### 标题:Manufacturing Execution Systems - MES 在当前快速发展的工业环境中,制造执行系统(MES)已成为制造业不可或缺的一部分。它为工厂提供了实时生产信息,帮助管理层做出更明智的决策。本书...

    GE Proficy Batch Execution 批处理控制系统在龙岩卷烟厂香料中心的应用.pdf

    GE Proficy Batch Execution 批处理控制系统在龙岩卷烟厂香料中心的应用pdf,GE Proficy Batch Execution 批处理控制系统在龙岩卷烟厂香料中心的应用

    Preboot Execution Environment (PXE) Specification -- Version 2.1

    Preboot Execution Environment (PXE) 是一种网络启动技术,它允许计算机通过网络从远程服务器获取操作系统映像并进行安装或启动。PXE 特别适用于大规模部署操作系统、更新和维护,因为它消除了对物理介质(如光盘或...

    pointcut表达式and or not在xml中配置

    <aop:pointcut id="serviceMethods" expression="not execution(* com.babyhen.service..LoginService.*(..)) and execution(* com.babyhen.service..*Service.*(..))"/> ``` 在这个例子中: - `not execution...

Global site tag (gtag.js) - Google Analytics