Deleting android apps from activity -


good day!

are there tools in android sdk, can use remove application activity. in particular, need activity method, removes other application same app-name, other package.

if mean "same name app" app same label define in xml menifest label of app, snippest should work:

private void deleteappbyactivityname(@nonnull string myapplabel,@nonnull context context){   try {       packagemanager pm = context.getpackagemanager();       intent mainintent = new intent(intent.action_main, null);       mainintent.addcategory(intent.category_launcher);       list<resolveinfo> dataindevice = pm.queryintentactivities(mainintent, 0);       (resolveinfo resolveinfo : dataindevice){           string label = resolveinfo.loadlabel(pm).tostring();           if (label.equals(myapplabel)) { //we find app same name ours               intent intent = new intent(intent.action_delete);               intent.setdata(uri.parse("package:" + resolveinfo.activityinfo.packagename));               context.startactivity(intent);               break;           }       }   }catch (activitynotfoundexception e){       e.printstacktrace();   } 

}


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -