7

I am able to install an apk file stored on sdcard using the following code:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("/mnt/sdcard/downloads/Sample.apk")), "application/vnd.android.package-archive");
startActivity(intent);

How can I install an apk file stored in assets folder? Is it possible?

midhunhk
  • 5,470
  • 7
  • 50
  • 79
Sandy
  • 7,312
  • 6
  • 31
  • 39

1 Answers1

11

use following code to write file on sdcard: How to copy files from 'assets' folder to sdcard? and from that path install by following:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");
startActivity(intent);  
Community
  • 1
  • 1
jeet
  • 28,501
  • 6
  • 50
  • 52