How to Install / Uninstall .apk file application programmatically on Android?

Are you want to install / Uninstall .apk file application programmatically on Android?


Install / Uninstall .apk file application programmatically on Android steps

For Installation:
To Installation .apk application programmatically on Android, use following code
  Intent intent = new Intent(Intent.ACTION_VIEW);
         intent.setDataAndType(Uri.fromFile(new File

                 (Environment.getExternalStorageDirectory() + “/karsho.apk”)),
                 “application/vnd.android.package-archive”);
         startActivity(intent);

For Uninstallation
To Uninstallation .apk application programmatically on Android, use following code
  Intent intent = new Intent(Intent.ACTION_DELETE);
         intent.setData(Uri.parse(“package:com.android.karsho”));
         startActivity(intent);

0 comments: