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

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

问题描述

  1. 一旦在Google Play开发者控制台中提交了对应用程序的更新,并且所有用户都可以看到该应用程序,那么任何设备要花多少时间才能选择该更新? (假设全天都处于活动状态的Internet 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天全站免登陆