{"id":47,"date":"2023-12-13T11:33:09","date_gmt":"2023-12-13T11:33:09","guid":{"rendered":"https:\/\/zerofold.in\/blogs\/?p=47"},"modified":"2023-12-15T07:41:46","modified_gmt":"2023-12-15T07:41:46","slug":"removing-an-app-programmatically-in-android","status":"publish","type":"post","link":"https:\/\/zerofold.in\/blogs\/blog\/2023\/12\/13\/removing-an-app-programmatically-in-android\/","title":{"rendered":"Removing an App programmatically in Android"},"content":{"rendered":"\n<p>While removing an app can be useful from the point of view of memory clean up in a project the communicates with other modules, it can be used with certain malicious intent. <\/p>\n\n\n\n<p>Regardless, here is how you can remove an app with some chunk of lines of code. <\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.042), 0.9rem);\"><code>\/\/ Replace with the package name of the app you want to uninstall\nval packageName = \"com.example.package\" \n\nval intent = Intent(Intent.ACTION_DELETE)\nintent.data = Uri.parse(\"package:$packageName\")\nstartActivity(intent)<\/code><\/pre>\n\n\n\n<p>Another method that is also viable, but one has to be proficient with Command Line Interface. Using Android Debug Bridge, which is a command line tool, you can uninstall the application without any permissions or having access of root. Here is how you can uninstall an app using ADB:<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.042), 0.9rem);\"><code>adb uninstall com.example.package<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Regardless of how you uninstall an application, make sure user consent or action was received.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While removing an app can be useful from the point of view of memory clean up in a project the communicates with other modules, it can be used with certain malicious intent. Regardless, here is how you can remove an app with some chunk of lines of code. Another method that is also viable, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,9],"tags":[6,5,24,21,22,23,20,7,8],"class_list":["post-47","post","type-post","status-publish","format-standard","hentry","category-android","category-mobile","tag-adb","tag-android","tag-bridge","tag-command","tag-command-line","tag-debug","tag-memory","tag-mobile","tag-tech"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/posts\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":5,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":94,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/posts\/47\/revisions\/94"}],"wp:attachment":[{"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zerofold.in\/blogs\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}