官方文档是这么写的:(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事件分发机制与嵌套导致触摸事件冲突的解决方案
  2. 利用java实现android项目结构API文档
  3. Android(安卓)内核编绎错误解决方案
  4. Android:Textview 通过代码设置 Drawable
  5. Android.网络拨号脚本
  6. Android(安卓)Studio 3.0新建项目AAPT2 编译报错 Error:java.uti
  7. Android(安卓)Studio Check Updates Connection failed (Connect
  8. UE4安卓打包报错及解决方案
  9. Android(安卓)自定义AlertDialog 去黑边终极解决方案(亲测有效!)

随机推荐

  1. 如何改变Android(安卓)Progressbar默认颜
  2. Android游戏开发之旅七 自定义SurfaceVie
  3. Android导入工程出现 Project has no def
  4. android的文字识别OCR
  5. Activity跳转时 进入和出去的动画
  6. 使用镜像站同步android sdk
  7. Android(安卓)- Linkify 详解
  8. 3.addView调用之后导致子布局的android:l
  9. Android(安卓)图片处理 之 Bitmap
  10. Android(安卓)NDK r8e java.lang.Unsatis