zoukankan      html  css  js  c++  java
  • Android 3.1以后 广播接收器的新机制

    Launch controls on stopped applications

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

    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.

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

    When neither or both of these flags is defined in an intent, the default behavior is to include filters of stopped applications in the list of potential targets.

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

    Applications are in a stopped state when they are first installed but are not yet launched and when they are manually stopped by the user (in Manage Applications).

    静态注册的广播接收器,接收系统的广播,如果应用处在了stop状态了,是接收不到的。

    首次安装未启动过和在系统设置的程序管理界面强行停止的应用都是处在stop状态。  默认广播的Intent是包含FLAG_EXCLUDE_STOPPED_PACKAGES 这个标记的,即不会激活stop状态的应用。

  • 相关阅读:
    求概率 Bag of mice CodeForces
    HDU 3853 LOOPS(概率DP)
    HDU 4405 Aeroplane chess (概率DP & 期望)
    求期望 ZOJ 3329 One Person Game
    poj 3774 Scout YYF I (矩阵优化的概率DP)
    codeforces 600D Area of Two Circles' Intersection
    codeforces 600A Extract Numbers
    codeforces 600C Make Palindrome
    POJ
    POJ
  • 原文地址:https://www.cnblogs.com/zijianlu/p/2892980.html
Copyright © 2011-2022 走看看