3

I use Eclipse to create android application (1). Now, I want this application can open and install file apk (2) inside application (1).

file apk (2) inside android project example: Android project/res/drawable/file.apk

When open android application (1) esle have button. When click button esle install file.apk

tshepang
  • 12,111
  • 21
  • 91
  • 136
user2940501
  • 31
  • 1
  • 5

1 Answers1

1

I think this question has already been answered before here: Install Application programmatically on Android

This is the part I think you need, I have just copied it from the link above in case that link breaks or something.

Intent promptInstall = new Intent(Intent.ACTION_VIEW)
    .setDataAndType(Uri.parse("file:///path/to/your.apk"), 
                    "application/vnd.android.package-archive");
startActivity(promptInstall); 

Like the guy in the other post says this will ask the user if they want to install the apk. You can't force an apk install unless the device is rooted and your program has root.

Community
  • 1
  • 1
  • Thanks you very much! http://3gp.vn/wp-content/uploads/2013/10/screen_2013-10-31-18.45.19.jpg What is URL to file apk in image? Is it file://sdcard/Android/data/open.file.hkienquyet/app.apk ? – user2940501 Oct 31 '13 at 11:57