Android|Android根据包名清理App数据

//注意权限

import android.content.pm.IPackageDataObserver;
【Android|Android根据包名清理App数据】ActivityManageram= (ActivityManager)context.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);

String[]clearPackageName={"com.tencent.mm","com.tencent.mobileqq","com.android.browser"};
for (String name : clearPackageName) {
boolean flag =am.clearApplicationUserData(name, new ClearUserDataObserver());
Log.e("LHW","clean_data finish "+flag);
}

classClearUserDataObserver extends IPackageDataObserver.Stub {
public void onRemoveCompleted(finalString packageName, final boolean succeeded) {
Log.e("LHW","IPackageDataObserversucceeded="+succeeded);
}
}

    推荐阅读