Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android installed app, never used, cannot receiver BroadcastReceiver

Android installed app, never used, cannot receiver BroadcastReceiver

編輯:關於Android編程

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 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).     解決方案:1、在發廣播的時候加上intent.setFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)     2、把apk放在/system/app/下
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved