简体   繁体   English

在Android中以编程方式从谷歌播放更新应用程序

[英]Update app from google play programmatically in android

In my app I have a link. 在我的应用程序中,我有一个链接。 When clicking on the link, I want to send the user to Google Play and update the app automatically. 点击链接后,我想将用户发送到Google Play并自动更新应用。

I tried this: 我试过这个:

// package name from menifest: com.infibond.infi
public void installInfiApplication(View view){
    final String apkurl = "market://details?id=" + "com.infibond.infi";
    final Uri marketUri = Uri.parse(apkurl);

    Intent promptInstall = new Intent(Intent.ACTION_VIEW).setData(marketUri);
    startActivity(promptInstall);
}

But this sent the user to the store without updating the app. 但这会将用户发送到商店而不更新应用程序。

Is there a way to do it? 有办法吗? If yes then what is it? 如果是,那么它是什么?

Google does not currently provide a way to automatically start updating an app through an Intent. Google目前不提供通过Intent自动开始更新应用的方法。 It seems unlikely that they ever will since it takes control of app installations away from users. 它们似乎不太可能,因为它可以控制应用程序安装远离用户。 Users can however enable auto updates for your app to get updates as soon as they are available unless the update requires new permissions (pre Android Marshmallow). 但是,用户可以为您的应用启用自动更新,以便在可用时立即获取更新,除非更新需要新的权限(在Android Marshmallow之前)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM