以编程方式从 Google Play 触发应用更新 [英] Programmatically trigger app update from Google play

查看:15
本文介绍了以编程方式从 Google Play 触发应用更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 在 Google Play 开发者控制台中提交应用更新并且该应用对所有用户可见后,任何设备需要多长时间才能选择更新?(假设全天都有活动的互联网 wifi 连接,并且此应用已开启自动更新)

  1. Once an update to app is submitted in Google play developer console and the app is visible to all users, how much time would it take for any device to pick the update? (Assuming active internet wifi connection is throughout the day and auto-update is on for this app)

我可以在没有任何用户提示或任何交互的情况下以编程方式向 Google Play 商店发起关于更新的请求吗?(假设更新时没有请求新的权限).如果是这样,请建议如何.

Can I programmatically initiate a request to Google play store regarding the update WITHOUT ANY USER PROMPT OR ANY INTERACTION? (Assuming no new permissions are requested while updating). If so, please suggest how.

其他信息:我的应用是为使用 android 盒子的数字标牌而设计的.应用程序在启动时启动,占据屏幕.在应用的生命周期内,不会有任何形式的用户直接与应用交互.

Other information: My app is designed for digital signage using android boxes. App is launched on startup, occupies the screen. There will not be any sort of user interaction directly with the app during its lifetime.

推荐答案

  1. 如果用户保持与互联网的有效连接和充足的电池,通常会在 24 小时内安装更新.Android 盒子没有任何电池,因此通过 google play 自动更新(无需任何用户交互)并不可靠.

  1. Usually update is installed within 24 hours, provided the user maintains active connection with internet and sufficient battery. Android boxes do not have any battery, so automatic updates via google play (without any user interaction) are not reliable.

使用此代码在没有 Playstore 的情况下发出自动更新.

Use this code for issuing auto update without playstore.

添加这个权限:<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>

使用以下函数:

public static void installAPK(String filename) {
    File file = new File(filename);
    if (file.exists()) {
            Runtime.getRuntime().exec("chmod 777 " + filename);
            String command;
            command = "pm install -r " + filename;
            Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", command});
            proc.waitFor();
        }
}

注意:这仅在您自上次安装后未请求应用程序的任何额外权限时才有效.

Note: This would work only if you are not requesting any extra permissions for the app since last install.

这篇关于以编程方式从 Google Play 触发应用更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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