gpt4 book ai didi

android - 将 "installer"包值设置为 getInstallerPackageName() 中返回的值

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:01:02 31 4
gpt4 key购买 nike

我有一个 Android 应用程序,它使用 WebView 使用户能够安装应用程序。过去,从 Android Market 安装的应用程序会将安装程序值设置为“com.google.android.feedback”。对于 Google Play,此值现在为“com.android.vending”。

这个值可以通过以下方式获得:

PackageManager pm = context.getPackageManager();
String installer = pm.getInstallerPackageName(pname);

我的 WebView 安装的应用程序将安装程序值设置为 null。如何设置我自己的安装程序值,例如 com.mydomain.store

最佳答案

虽然这并不能严格回答以编程方式执行此操作的问题,但也可以通过 adb 设置供应商包,而无需使用相同的 key 对其进行签名。

There's a complete explanation here ,但归结为:

The following adb trick sets the install vendor of a debug app:

adb push app.apk /data/local/tmp/app.apk
adb shell pm install -i "com.android.vending" -r /data/local/tmp/app.apk
adb shell rm /data/local/tmp/app.apk

To confirm that this has worked, list the packages using the PackageManager:

adb shell pm list packages -i [packagename]

If all has gone well, you should see this output:

package:[packagename]  installer=com.android.vending

关于android - 将 "installer"包值设置为 getInstallerPackageName() 中返回的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9146820/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com