0

I've and application that requires a secondary application to be installed to work . Reason for this vary, mostly memory (both flash and ram) footprint if this is used from multiple applications. Anyway, it's not very convinient that a user has to go to the playstore again after having downloaded and started the first app.

Now I've discovered google drive does the same with google docs/sheets/presentation. You first install google drive, and when you need another application you still need to install it.

However google drive manages to show an "do you want to install this application" popup immediately instead of just redirecting the user to the playstore: See https://drive.google.com/file/d/0BxHD8LQaDPnrbXpEcm1HdV9KVkpNOUlRWldyVjhBbnFkSFJN and https://drive.google.com/file/d/0BxHD8LQaDPnrRS1PSHdyNDRXT3Nzb3BBVjNfSDVRbDZhaGpN

Question is: does anybody have an idea how to do this? Or is this an api that only google apps are allowed to use? I've not found any documentation about it. Decompiling the google drive app also did not help me much, it's heavily proguarded.

mouse256
  • 53
  • 4

1 Answers1

0
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
    .setDataAndType(Uri.parse(yourApkFilePath), 
                    "application/vnd.android.package-archive");
startActivity(promptInstall); 

Download apk file to sdcard(from your server) and use above code with filepath. It opens a prompt to the user whether to install new application.

Note: this works only if the user checks "Install app from external sources" in the Settings

Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109
  • That's indeed an option, but not the way I want to go. I want to distribute the other app also through google play (not having to host it on my own server) and don't want to rely on the "install app from external sources" option which will be disabled for most users. – mouse256 Sep 03 '14 at 08:51
  • Then all you can do is open Google Play Store using intent and user has to explicitly install the app. Google drive is by Google. So they can do anything. I don't think there is a way to do it in the other apps. – Seshu Vinay Sep 03 '14 at 09:18