public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { // install
String packageName = intent.getDataString();
packageName = filterPackage(packageName);
Log.i(TAG, "install:" + packageName);
boolean isReplacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING,false);
int uid = intent.getIntExtra(Intent.EXTRA_UID,0);
Log.i(TAG, "install: isReplacing = " + isReplacing);
Log.i(TAG, "install: uid = " + uid);
if(!isReplacing){
//全新安装,处理的逻辑处
}
}
}
Android番外篇 监听应用安装
最新推荐文章于 2024-07-30 17:08:10 发布