android - 在 android 中以编程方式从 google play 更新应用程序

标签 android android-intent google-play

在我的应用程序中有一个链接。单击链接时,我想将用户转到 Google Play 并自动更新应用。

我试过这个:

// 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);
}

但这会将用户发送到商店而不更新应用程序。

有办法吗?如果是,那是什么?

最佳答案

Google 目前不提供通过 Intent 自动开始更新应用程序的方法。他们似乎不太可能这样做,因为它从用户手中夺走了应用程序安装的控制权。但是,用户可以为您的应用启用自动更新,以便在更新可用时立即获取更新,除非更新需要新权限(Android Marshmallow 之前)。

关于android - 在 android 中以编程方式从 google play 更新应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36444083/

相关文章:

android - 有没有办法判断 Google map fragment 中的相机何时停止移动?

android - 如何检查设备是否可以通过 Activity 的 WiFi 连接访问互联网?

Android 解析 "invalid session token"错误

java - 为什么 Image 可以返回到之前的 Activity,但不能返回到新的 Activity

android - 将当前 Intent 作为额外的内容传递给另一个 Activity

android - Ionic - 将新版本上传到 Google Play Dev 会导致错误

java.lang.UnsatisfiedLinkError : dlopen failed: library "libc++.so" not found 错误

android - 正确处理来自 IntentService 的 sendBroadcast()

android - Google Maps 开发和发布之间的关键

android - Google Play 结算 : how to simulate 'Account Hold' status (in debug/sandbox mode)