Android how to install apk file stored in resources folder

I can install the apk file stored on the SD card 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 to install apk file stored in resource folder? Is it possible?

+6
source share
1 answer

use the following code to write the file to sdcard: How to copy files from the assets folder to sdcard? and from this path install the following command:

 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); 
+9
source

Source: https://habr.com/ru/post/908117/


All Articles