1

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?

suhaspt89
  • 21
  • 1
  • 4

2 Answers2

3

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

Community
  • 1
  • 1
Trung Nguyen
  • 7,442
  • 2
  • 45
  • 87
  • After you install it, is there a way to re-launch the application? Right now it just returns to the home screen and you have to manually re-launch it. – Joshua Pinter Nov 03 '18 at 01:50
0

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