3

As you know Flash Player is not distributed on the market anymore, but I've got some apk of Flash hosted on the Internet (example here: http://d-h.st/w2B)

I made an application where Flash is required and so I was wondering if can make something that if a customer click on a button, it will automatically download and install flash on his device?

I found this code to download my apk, but it doesn't work on my Android device, why?

String url = "http://charlie.d-h.st/w2B/00010/Adobe%20Flash%20Player%2011.1%20%281%29.apk";
Uri uri = Uri.parse(url.toString());
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(browserIntent);
double-beep
  • 5,031
  • 17
  • 33
  • 41
user1708001
  • 63
  • 2
  • 5

2 Answers2

2

Yes, you can download APK and initialize its installation process, but user will have to accept (or deny) this request. You cannot do the silent or unattended installation.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
1

Yes, you have to download app and use this code to call installer:

File appFile = new File("application.apk");
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(Uri.fromFile(appFile),"application/vnd.android.package-archive");
startActivity(installIntent);

Or you can do the silent on rooted device using this tutorial.

or use below code to install application from market:

Intent market = new Intent(Intent.ACTION_VIEW)
    .setData(Uri.parse("market://details?id=com.mypackage.name"));
startActivity(market);
Armin
  • 599
  • 2
  • 8
  • 19
  • To download the apk i use this code, but it doesn't like to works whyyy D: String url = "http://charlie.dh.st/w2B/00010/Adobe%20Flash%20Player%2011.1%20%281%29.apk"; Uri uri = Uri.parse(url.toString()); Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); startActivity(browserIntent); – user1708001 Oct 26 '12 at 12:42
  • look at my answer again. i added installing application from market, – Armin Oct 26 '12 at 12:57
  • check it out: http://www.hassanpur.com/blog/2011/04/android-development-downloading-a-file-from-the-web/ – Armin Oct 26 '12 at 15:09