Android 代码监控apk安装,卸载,替换
public class GetBroadcast extends BroadcastReceiver {
private static GetBroadcast mReceiver = new GetBroadcast();
private static IntentFilter mIntentFilter;
public static void registerReceiver(Context context) {
mIntentFilter = new IntentFilter();
mIntentFilter.addDataScheme("package");
mIntentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
mIntentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
mIntentFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
context.registerReceiver(mReceiver, mIntentFilter);
}
public static void unregisterReceiver(Context context) {
context.unregisterReceiver(mReceiver);
}
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
Toast.makeText(context, "有应用被添加", Toast.LENGTH_LONG).show();
} else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
Toast.makeText(context, "有应用被删除", Toast.LENGTH_LONG).show();
}
/*
* else if(Intent.ACTION_PACKAGE_CHANGED.equals(action)){
* Toast.makeText(context, "有应用被改变", Toast.LENGTH_LONG).show(); }
*/
else if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) {
Toast.makeText(context, "有应用被替换", Toast.LENGTH_LONG).show();
}
/*
* else if(Intent.ACTION_PACKAGE_RESTARTED.equals(action)){
* Toast.makeText(context, "有应用被重启", Toast.LENGTH_LONG).show(); }
*/
/*
* else if(Intent.ACTION_PACKAGE_INSTALL.equals(action)){
* Toast.makeText(context, "有应用被安装", Toast.LENGTH_LONG).show(); }
*/
}
}
Android 代码监控apk安装,卸载,替换的更多相关文章
- 【Android】Android 监听apk安装替换卸载广播
[Android]Android 监听apk安装替换卸载广播 首先是要获取应用的安装状态,通过广播的形式 以下是和应用程序相关的Broadcast Action ACTION_PACKAGE_ADDE ...
- Android 监听apk安装替换卸载广播
首先是要获取应用的安装状态,通过广播的形式 以下是和应用程序相关的Broadcast Action ACTION_PACKAGE_ADDED 一个新应用包已经安装在设备上,数据包括包名(最新安装的包程 ...
- Android开发——Android系统启动以及APK安装、启动过程
0. 前言 从Android手机打开开关,到我们可以使用其中的app时,这个启动过程到底是怎么样的? 1. 系统上电 当给Android系统上电,在电源接通的瞬间,CPU内的寄存器和各引脚均会被 ...
- 帮同事写了几行代码,在 安装/卸载 程序里 注册/卸载 OCX控件
写了个小控制台程序,这个程序用来注册 / 卸载OCX控件,用在Inno Setup做的安装卸载程序里. #include "stdafx.h" #include <windo ...
- apk安装 卸载 原理
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 复制 apk到 /data/app目录下,解压并扫描 安装包, 把 dex文件,保存到 ...
- Android中下载、安装和卸载(原)
应用场景:在检查版本更新的时候经常需要从服务器端下载然后安装到手机中 使用工具: XUtils,这个开源的框架真的是需要花大把时间去阅读和理解的,十分有用的,on the way ! fighting ...
- Android 安装 卸载 更新 程序
安装程序的方法: .通过Intent机制,调出系统安装应用,重新安装应用的话,会保留原应用的数据. 1. String fileName =Environment.getExternalStorage ...
- android 静默安装 卸载 资料汇总
1. android + eclipse + 后台静默安装(一看就会) 2. 适用于android1.5以下版本apk静默安装 3. error: INSTALL_FAILED_SHARED_USER ...
- Android中APK安装过程及原理解析
[原文] 来自华为内部资料 应用安装是智能机的主要特点,即用户可以把各种应用(如游戏等)安装到手机上,并可以对其进行卸载等管理操作.APK是Android Package的缩写,即android安装包 ...
随机推荐
- Spring MVC 环境搭建(二)
在Spring MVC 环境搭建(一)中我们知道 spring 的配置是通过 urlmapping 映射到控制器,然后通过实现Controller接口的handlerequest方法转向页面. 但这存 ...
- android 自动化压力测试-monkey 1 实践
Monkey是Android中的一个命令行工具,可以运行在模拟器里或实际设备中.它向系统发送伪随机的用户事件流(如按键输入.触摸屏输入.手势输入等),实现对正在开发的应用程序进行压力测试.Monkey ...
- Codeforces Round #109 (Div. 2) E. Double Profiles hash
题目链接: http://codeforces.com/problemset/problem/155/E E. Double Profiles time limit per test 3 second ...
- 用boost共享内存实现进程通信的例子
发送端 #include "DBProc1.h" #include <string> #include <thread> #include <boos ...
- JAVA算法系列 冒泡排序
java算法系列之排序 手写冒泡 冒泡算是最基础的一个排序算法,简单的可以理解为,每一趟都拿i与i+1进行比较,两个for循环,时间复杂度为 O(n^2),同时本例与选择排序进行了比较,选择排序又叫直 ...
- RMQ(st)
int dp[1111][12]; int a[1111]; int n; void RMQ_init() { for(int i=1;i<=n;i++) { d ...
- 【译】 沙箱中的间谍 - 可行的 JavaScript 高速缓存区攻击
王龑 - MAY 27, 2015 原文连接 The Spy in the Sandbox – Practical Cache Attacks in Javascript 相关论文可在 https:/ ...
- poj 3469
Dual Core CPU Time Limit: 15000MS Memory Limit: 131072K Total Submissions: 18120 Accepted: 7818 ...
- uva 11294
Problem E: Wedding Up to thirty couples will attend a wedding feast, at which they will be seated on ...
- POJ 2001
#include<iostream> using namespace std; ; struct trienode { trienode * next[kind]; int branch; ...