如何以编程方式安装应用程序而无需打开Play商店(就像Google云端硬盘一样) [英] How to install applications programmatically without opening Play Store (as Google Drive does)

查看:132
本文介绍了如何以编程方式安装应用程序而无需打开Play商店(就像Google云端硬盘一样)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,Google云端硬盘应用询问我是否要安装新的应用表格和表格;文档.

Today the Google Drive app asked if I wanted to install the new apps Sheets & Docs.

我已经接受,希望它可以打开Goog​​le Play商店,这样我就可以按install了.

I've accepted, expecting it to open Google Play Store so I could press install.

没有.它只是向我显示了具有每个应用程序权限的弹出窗口以确认安装,与您在Play商店中的任何应用程序上按安装"时所显示的弹出窗口相同.

It didn't. It just showed me the popup with the permissions of each of the apps to confirm the installation, the same that appears when you press "Install" on any app on the Play Store.

我不知道可以做到这一点.

I was not aware this could be done.

我们如何在应用程序中重现此行为:有一个不需要打开Goog​​le Play商店的安装应用程序XPTO"按钮?只是显示权限对话框,然后继续通过Play商店安装它?

How can we reproduce this behavior in an app: have a button "Install App XPTO" which doesn't need to open Google Play Store? Just shows the permissions dialog and proceeds to install it via Play Store?

更新:

对于那些投票否决的人,因为他们认为这与其他问题相同……不是!

For those downvoting because they think this is the same as other questions... It's not!

在这种情况下,APK不会通过Google云端硬盘应用下载,然后安装. Google云端硬盘"告诉" Play商店以下载&安装.

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

那是我感兴趣的API.

That's the API that I'm interested.

要支持我的情况:在按在不打开Play商店的情况下在Google云端硬盘中安装应用程序后,下载会开始.在下载过程中,我打开了Play商店进行检查并进行以下操作:

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

该屏幕截图证明不是Google云端硬盘下载并安装了APK.这是Play商店.

The screenshot proves that it isn't Google Drive downloading the APK and the installing it. It's the Play Store.

推荐答案

Google云端硬盘的日志显示,负责告诉" Google Play商店安装应用的活动是

The logs for Google Drive shows that activity responsible for "telling" the Google Play Store to install apps is

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

显然是告诉"

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

安装必需的软件包.

因此,从理论上讲,人们可以创造一种意图

So, theoretically, one could create an intent

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 correct extra values and voilà!

但是,从非Google签名的应用程序调用LightPurchaseFlowActivity失败,因为显然(根据日志)它们再次检查了调用程序包的签名:

However, calling LightPurchaseFlowActivity from non-Google signed app is failing, because they are, again apparently (according to the logs), checking the calling package's signature:

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

所以,目前还无法实现.

So, there, this can not be achieved at this moment.

这篇关于如何以编程方式安装应用程序而无需打开Play商店(就像Google云端硬盘一样)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆