官方文档是这么写的:(http://developer.android.com/about/versions/android-3.1.html#launchcontrols)

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.

  • FLAG_INCLUDE_STOPPED_PACKAGES— Include intent filters of stopped applications in the list of potential targets to resolve against.
  • FLAG_EXCLUDE_STOPPED_PACKAGES— Exclude intent filters of stopped applications from the list of potential targets.

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 addsFLAG_EXCLUDE_STOPPED_PACKAGESto 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 theFLAG_INCLUDE_STOPPED_PACKAGESflag 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).


解决方案:1、在发广播的时候加上intent.setFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)

2、把apk放在/system/app/下

更多相关文章

  1. Android(安卓)关闭所有的Activity
  2. IPPH-发送广播
  3. 在启动activity之前,调用application的oncreate
  4. Android(安卓)UDP广播包抓取
  5. android 中 intent和intent action大全
  6. listView当中有嵌套了有onClickListener的控件时ListView自身的o
  7. Android:媒体按键消息
  8. Android(安卓)Studio电脑不支持HAXM的解决办法
  9. Android中关于EditText不能取得值的问题解决方案

随机推荐

  1. Android(安卓)常用RGB值以及中英文名称
  2. Android(安卓)com.android.internal.R 添
  3. Android(安卓)文件操作,删除,拷贝文件等
  4. Android常遇疑难问题
  5. Android内存管理
  6. layer-list使用
  7. Android(安卓)FloatingActionButton控件
  8. android PopUp window的使用
  9. 部署Android(安卓)SDK 和Eclipse 插件
  10. Android在listview添加checkbox实现单选