Programmatically trigger app update from Google play

后端 未结 3 1274
小鲜肉
小鲜肉 2021-01-22 09:10
  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?

3条回答
  •  盖世英雄少女心
    2021-01-22 09:32

    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.

    2. Use this code for issuing auto update without playstore.

    Add this permission:

    Use the following function:

    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.

提交回复
热议问题