b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

android框架揭秘_fossdroid_android c 高级编程

电脑杂谈  发布时间:2016-11-23 22:03:50  来源:网络整理

fossdroid_android c  高级编程_android框架揭秘

很遇到过广播收不到的问题,比如Google Play推广安装广播没有收到等,诸如这些问题,又都是什么原因呢,这篇文章将进行回答。

从Android3.1(HoneyComb)也就是API12开始,Android引入了一套新的启动控制,这就是程序的停止状态。android框架揭秘那我么看一下Google对于程序的停止状态的描述。

什么是停止状态

Starting from Addroid3.1,the system's package manager keeps track of applications that are in a stopped state and provides a means of controllling their launch from background processes and other applications.

从Adroid3.1开始,系统的包管理器开始跟踪处理停止状态的程序。并且提供了方法来控制从后台进程或者其他程序对他们的启动。

Note that an application's stopped state is not the same as an Activity's stopped state.The system manages those two stopped states separately.

注意,程序的停止状态和Activity的停止状态不同,系统会单独处理这两种状态。

the platform defines two new intent flags that let a sender specify whether the Intent should be allowed to activate components in stopped application.

Android平台提供了两个Intent flags,用来让发送广播的一方决定广播是否需要同时发送给已经停止的程序。

Intent.FLAG_INCLUDE_STOPPED_PACKAGES —— Include intent filters of stopped applications in the list of potential targets to resolve against.

将已经支持的程序加入到能处理intent的目标处理者。

Intent.FLAG_EXCLUDE_STOPPED_PACKAGES —— Exclude intent filters of stopped application from the list of potential targets.

在能处理intent的目标处理者中不包含已经停止的程序。android框架揭秘

当如果intent中没有或者设置了上面两个flag,在目标处理者中是包含已经处理停止的程序。但是注意,系统会为所有的广播intent增加FLAG_EXCLUDE_STOPPED_PACKAGES这个flag.

为什么Android要引入这一状态

Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents. It does this to prevent broadcasets from background services from inadvertently or unnecessarily launching components of stopped applications. A background service or application can override this behavior by adding the FLAG_INCLUDE_STOPPED_PACKAES flag to broadcast intents that should be allowed to activate stopped applications.


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-21669-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    每日福利
    热点图片
    拼命载入中...