suhaspt89
suhaspt89

Reputation: 21

How to download & install .apk file in Android application?

I have one java Web Application through this application I am sending the URL to download the .apk file.now I have to use this URL in my Android Simulator browser to download .apk file and install automatically. So can anyone please give me the solutions to this problems?

Upvotes: 1

Views: 10377

Answers (2)

Trung Nguyen
Trung Nguyen

Reputation: 7532

Just do these step:

1, Download file use Asynctask or Service. Solution here

2, Pass downloaded file to package installer.

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);

It's simple set path to downloaded file and mime type. More detail here. You can also look to the right. There is a list of related questions like yours

Upvotes: 3

Ramachandra Reddy Avula
Ramachandra Reddy Avula

Reputation: 1114

In browser type url and press enter ,it will ask to install. But file automatically installation process is basing on Device. If you go for Htc mobile It will be automatically installed but not for samsung mobiles

Upvotes: 0

Related Questions