监听开机,程序安装,卸载,唤醒
来源:互联网 发布:天刀捏脸数据导出 编辑:程序博客网 时间:2024/06/06 13:21
public class PushReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if(Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())){ System.out.println("手机开机了...bootComplete!"); }else if(Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())){ System.out.println("新安装了应用程序....pakageAdded!"); }else if(Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())){ System.out.println("应用程序被卸载了....pakageRemoved!"); }else if(Intent.ACTION_USER_PRESENT.equals(intent.getAction())){ System.out.println("手机被唤醒了.....userPresent"); Intent service = new Intent(); service.setAction("com.xxx.service.PushService"); service.setClass(context, PushService.class); context.startService(service); } }}
Mainfest中注册receiver:
<!-- push receiver --> <receiver android:name=".receiver.PushReceiver"> <intent-filter> <!-- 手机开机 --> <action android:name="android.intent.action.BOOT_COMPLETED"></action> <!-- 手机唤醒解锁 --> <action android:name="android.intent.action.USER_PRESENT" /> </intent-filter> <intent-filter> <!-- 程序包安装与卸载 --> <action android:name="android.intent.action.PACKAGE_ADDED"></action> <action android:name="android.intent.action.PACKAGE_REMOVED"></action> <data android:scheme="package"></data> </intent-filter> </receiver>
0 0
- 监听开机,程序安装,卸载,唤醒
- 程序安装/卸载事件监听
- android监听程序安装、卸载
- Android监听程序的安装和卸载
- 安卓开发监听程序安装卸载
- Android 监听程序的安装和卸载
- Android 监听程序的安装和卸载
- Android 监听程序的安装和卸载
- Android监听程序的安装和卸载
- Android监听程序的安装和卸载
- Android 监听程序的安装和卸载
- Android监听程序的安装和卸载
- Android 监听程序的安装、卸载、替换
- 实现网络唤醒开机程序
- 实现网络唤醒开机程序
- android 监听程序卸载
- 监听安装卸载
- Android监听安装卸载
- 函数
- 动画效果--Android
- 如何统计版本库中某一用户的提交次数
- onCreate中获得控件的大小
- android-support-v4.jar异常解决方法
- 监听开机,程序安装,卸载,唤醒
- Android 更改项目包名的方法
- 杂乱的接头中恰逢一丝偶闲
- Zxing二维码解析——图文转换
- ScrollView嵌套ListView只显示一行
- Parcelable序列化对象
- Android中打包JAR时获取资源ID的方法
- Android分享图片失败解决方案
- log(五)——MDC总结