Android根据包名清理App数据

//注意权限

import android.content.pm.IPackageDataObserver;

ActivityManager    am= (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);

               }

           }

你可能感兴趣的:(Android,MTK开发笔记集)