1

How to download application given URL and setup on android?

Example:

When the application runs, it will first control the web service to ask for a new application.

If there are any new applications, it will get the URL, downloads the file and install.

How can it be done?

gymcode
  • 4,431
  • 15
  • 72
  • 128
DooManfess
  • 303
  • 1
  • 4
  • 10

1 Answers1

3

You cannot install APKs that way -- only applications that are part of the system firmware can do that.

You should be able to use an ACTION_VIEW Intent, with a MIME type of application/vnd.android.package-archive and a Uri pointing to your file. Note that this may not work on devices that do not have "allow non-Market installs" checked.

Altaaf
  • 527
  • 3
  • 11
  • 1
    I checked "allow non-Market installs". Download and save apk in code. After run this code but i get package decomposion error File fullPath = new File(getExternalFilesDir(null), "example.apk"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(fullPath), "application/vnd.android.package-archive"); startActivity(intent); – DooManfess Feb 15 '12 at 08:08