0

I am shipping a .apk file to the assets folder of another apk. Now, I want to install the apk stored in assets folder . Install apk from assets folder automatically / programmatically.... is this possible .......?

Ganesh
  • 923
  • 1
  • 7
  • 12
  • You have to first copy the .apk from assets to the file system external memory. After that you can use an Intent. – greenapps Mar 23 '15 at 15:24

2 Answers2

1

You can do something like this.

Intent promptInstall = new Intent(Intent.ACTION_VIEW)
    .setDataAndType(Uri.parse("file:///path/to/your.apk"), 
                    "application/vnd.android.package-archive");
startActivity(promptInstall); 
Hardik Trivedi
  • 5,677
  • 5
  • 31
  • 51
  • Thanks Hardik , But tell me how to get the path of file(.apk) which is stored in assets folder ...what is absolute path I write instead of ("file:///path/to/your.apk")....??? – Ganesh Mar 23 '15 at 12:02
  • Hi Hardik ,I put the path ("file:///assets/first.apk"); It gives error "There was problem parsing the package". how to solve this problem....... – Ganesh Mar 23 '15 at 12:38
  • I havn't tried. But this should work, verify you apk once. Parsing error is only raised when OS can not read your apks – Hardik Trivedi Mar 23 '15 at 13:51
0

this is an old post but for others i want to share my experience with the same issue. The error "There was problem parsing the package" came because you have modify the apk name. you must let its original name. hope this help.

Sandra
  • 1