Skip to content Skip to sidebar Skip to footer

Install Android System App, Silent Update Without Google Play On Rooted Device.

I am trying to get my app to download an update from an ftp site, in the form of a new version of the apk. After download the apk should be installed silently, without any confirma

Solution 1:

So after a couple of years I got to that problem again, and I managed to solve it. So the most important part is rooting the phone properly: This was done with the SuperSU app.

After downloading the .apk file, a method similar to the following is used to install the update:

privateBoolean Install(String path)
{
    File file = new File(path);
    if(file.exists()){
        try {
            Process proc = Runtime.getRuntime().exec(newString[]{"su","-c","pm install -r -d " + path});
            proc.waitFor();
            BufferedReader input = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
            String line;
            Boolean hasError = false;
            while ((line = input.readLine()) != null) {
                if(line.contains("Failure")){
                    hasError = true;
                }
            }
            if(proc.exitValue() != 0 || hasError){
                returnfalse;
            }
        } catch (Exception e) {
            e.printStackTrace();
            returnfalse;
        }

        returntrue;
    }

    returnfalse;
}

Post a Comment for "Install Android System App, Silent Update Without Google Play On Rooted Device."