How to install applications programmatically without opening the Play Store (as Google Drive does)

Today, the Google Drive app asked if I want to install new Sheets and Docs apps.

I agreed, expecting it to open the Google Play Store so I can click on install.

This is not . He just showed me a pop-up window with the permissions of each of the applications to confirm the installation, the same thing that appears when you click "Install" in any application in the Play Store.

I did not know that this could be done.

How can we reproduce this behavior in the application: is there a "Install XPTO application" button that does not need to open the Google Play Store? Just shows a dialog with permissions and proceeds to install it through the Play Store?




UPDATE:

For those who seek, because they think that this is the same as other questions ... This is not so!

In this case, the APK is not downloaded by the Google Drive application and then installed. Google Drive "tells" the Play Store to download and install.

What an API that interests me.

To support my case: after clicking INSIDE Google Drive to install applications without opening the Play Store, the download starts . During the download, I opened the Play Store to check and:

enter image description here

The screenshot proves that Google Drive does not download the APK and does not install it. This is the Play Store.

+51
android
May 16 '14 at 12:35
source share
4 answers

Logs for Google Drive show that the activity responsible for “directing” the Google Play Store to install applications,

com.google.android.apps.docs/com.google.android.apps.docs.app.PhoneskyApplicationInstallerActivity 

which apparently "says"

 com.android.vending/com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity 

to install the necessary packages.

So, theoretically, you can create an intention

 Intent intent = new Intent("com.android.vending.billing.PURCHASE"); intent.setClassName("com.android.vending", "com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity"); intent.putExtra(EXTRA_NAME, EXTRA_VALUE); startActivityForResult(intent, 0); 

with the correct extra values ​​and voilà!

However, calling LightPurchaseFlowActivity from a non-Google-signed application fails because they again, apparently (according to the logs), verify the signature of the called package:

 W/Finsky(13209): [1] LightPurchaseFlowActivity.setupFromExternalPurchaseIntent: Called from untrusted package. 

So at this moment this cannot be achieved.

+50
May 20 '14 at 3:03
source share

Google+ now implements buttons in which you can directly download the application (see this link ) without clicking a button on the website of the playback store.

The link looks like this: https://play.google.com/store/apps/details?id=com.example.app&rdid=com.example.app&rdot=1&feature=md

If you add the rdid, rdot parameter and functions , it will work on my phone (if I print it in the browser, I did not check it with intent and did not test, update the application by installing it only).

Edit

I found out that you only need to add the rdid parameter in the URL. Source: http://www.androidb.com/2014/04/increase-app-installs-with-a-single-trick/

Edit2:

Doesn't work with intent .:(

+5
May 19 '14 at 9:39
source share

I would say that Google Drive has system permissions, as in the Play Store. Perhaps because it is signed with a Google signature.

If you manage to get permission "android.permission.INSTALL_PACKAGES", you can call the API (which is not included in android.jar, deployed by the SDK manager, you need to get hidden APIs from android.jar in for example an emulator) to install applications.

Thus, if you do not have system permissions (by adding the APK to / system / app, signed with an OEM certificate or using root), you cannot do this.

Source: Some system applications have already been programmed.

--- UPDATE

Of course, there may be some door in the game store that you can use to install any application, but this probably requires permissions that you cannot get yourself

+3
May 16 '14 at 1:47
source share

If you know where you have the apk file, you can easily.

 File file = new File(dir, "YourApp.apk"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); startActivity(intent); 
-one
May 16 '14 at 12:47
source share



All Articles