Android installed app, never used, cannot receiver BroadcastReceiver
官方文档是这么写的:(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 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/下
Android installed app, never used, cannot receiver BroadcastReceiver的更多相关文章
- Android——开机启动功能(Service和BroadcastReceiver)
BroadcastReceiver(广播接收器):发出广播让服务器去接收 BootReceiver.java package com.example.chenshuai.test321; import ...
- Android基础新手教程——4.3.1 BroadcastReceiver牛刀小试
Android基础新手教程--4.3.1 BroadcastReceiver牛刀小试 标签(空格分隔): Android基础新手教程 本节引言 本节我们将来学习Android四大组件中的第三个:Bro ...
- Android基础新手教程——4.3.2 BroadcastReceiver庖丁解牛
Android基础新手教程--4.3.2 BroadcastReceiver庖丁解牛 标签(空格分隔): Android基础新手教程 本节引言: 上节我们对BroadcastReceiver已经有了一 ...
- android基础(二)Broadcast Receiver知识
1.广播的注册 (1)动态广播注册: 优点:可以灵活控制广播的注册与撤销 缺点:必须在程序启动时才能接收广播 IntentFilter :当Intent在组建之间传递时,组件想告诉android系统自 ...
- Cordova 打包 Android release app 过程详解
Cordova 打包 Android release app 过程详解 时间 -- :: SegmentFault 原文 https://segmentfault.com/a/119000000517 ...
- 【Android端 APP GPU过度绘制】GPU过度绘制及优化
一.Android端的卡顿 Android端APP在具体使用的过程中容易出现卡顿的情况,比如查看页面时出现一顿一顿的感受,切换tab之后响应很慢,或者具体滑动操作的时候也很慢. 二.卡顿的原因 卡顿的 ...
- 分享我开发的网络电话Android手机APP正式版,图文详解及下载
分享我开发的网络电话Android手机APP正式版,图文详解及下载 分享我开发的网络电话Android手机APP正式版 实时语音通讯,可广域网实时通讯,音质清晰流畅! 安装之后的运行效果: 第一次安装 ...
- Android开发App工程结构搭建
本文算是一篇漫谈,谈一谈关于android开发中工程初始化的时候如何在初期我们就能搭建一个好的架构. 关于android架构,因为手机的限制,目前我觉得也确实没什么大谈特谈的,但是从开发的角 ...
- Android 启动APP黑屏解决方案
#Android 启动APP黑屏解决方案# 1.自定义Theme //1.设置背景图Theme <style name="Theme.AppStartLoad" parent ...
随机推荐
- mysql启动的四种方式
mysql的四种启动方式: .mysqld 启动mysql服务器:./mysqld --defaults-file=/etc/my.cnf --user=root 客户端连接: mysql --def ...
- img标签中的src为php文件
先来看个例子: <img src="imgcode.php" alt="看不清楚,换一张" style="cursor: pointer;&qu ...
- java web从零单排第二十一期《Hibernate》主键的生成方式,用户增加与显示用户列表
1.新建register.jsp <%@ page language="java" import="java.util.*" pageEncoding=& ...
- 使用 HTML5 webSocket API实现即时通讯的功能
project下载地址:http://download.csdn.net/detail/wangshuxuncom/6430191 说明: 本project用于展示怎样使用 HTML5 webSock ...
- Eclipse用法和技巧十八:减少不必要的输入
写代码的时候,很多人都有一个原则,尽量上输入.依靠IDE自动生成的代码,一般可读性,排版什么的都还是不错的,最主要的一般不会有什么低级错误.今天介绍几个在eclipse环境中,常用的依靠eclipse ...
- hdu3999The order of a Tree (二叉平衡树(AVL))
Problem Description As we know,the shape of a binary search tree is greatly related to the order of ...
- ZOJ 3622 Magic Number(数)
题意 假设一个正整数y满足 将随意正整数x放到y的左边得到的数z满足 z%y==0 那么这个数就是个Magic Number 给你一个范围 求这个范围内Magic Number的个数 令 ...
- 略懂 MySQL字符集
本文虽说旨在明白.但若略懂亦可.毕竟诸葛孔明如是 只有基于字符的值才有所谓字符集的概念 某些字符集可能需要更多CPU.消费更多的内存和磁盘空间.甚至影响索引使用 这还不包括令人 ...
- Jquery文本框小例(必填框)
<script src="../JavaScript/jquery-2.0.2.min.js"></script> <script type=&quo ...
- EasyUI - DataGrid 组建 - [ 样式功能 ]
效果显示: 同上次博文效果. html代码: 同上次博文代码. js代码: align: 'center',//标题和内容居中 resizable: false,//不允许改变大小 //hidden: ...