Install apk from another Android application without using an SD card

I managed to download the apk file and save it in the file /data/data/com.android.myApp/anotherApp.apk. I was wondering if there is a way to install this file from another application. I am currently using:

Intent intent = new Intent (Intent.ACTION_VIEW); intent.setDataAndType (Uri.parse (filepath), "application / vnd.android.package-archive"); startActivity (intent);

And here is my manifest file:

When I run it. This gives me "Parse Error: Parse Parse Problem". I do not know what's the problem? 1) Do I need to store the application on an SD card? I do not want to do this 2) Resolution issues? 3) is a damaged package installed?

+4
source share
3 answers

Usually, when you save files in the sandbox of your application, they are saved in the β€œfiles” folder. So, you full path should be:

 /data/data/com.android.myApp/files/anotherApp.apk 

If you are working on an emulator, you can make the adb ls shell to confirm if the file is valid:

 adb shell "ls /data/data/com.android.myApp/files" 
+1
source

You need to add filepath using file:// :

 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + filepath), "application/vnd.android.package-archive"); startActivity(intent); 
+2
source

Try this buddy ...

 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path+"/yourapp.apk")), application/vnd.android.package-archive"); startActivity(intent); 
+1
source

All Articles