Domanda

I'm trying to find a solution to do a remote update of an APK to 80 tablets. This should preferably be as automated as possible and if this can happen completely in the background without any user input that would be great. Basically what the Playstore currently do which I unfortunately can't use.

Is something like this possible without rooting the device? Any suggestion on libraries/ services that does this?

I'm running Android 4.1.1 and they will all be connected to a Wi-Fi.

È stato utile?

Soluzione

You can download the new APK file to SD card, then call this to install it:

Intent shareIntent = new Intent(Intent.ACTION_VIEW);
shareIntent.setDataAndType(Uri.fromFile(new File("path-to-APK-file")),
        "application/vnd.android.package-archive");

try {
    context.startActivity(shareIntent);
} catch (Throwable t) {
    // handle the exception here
}

There is only one thing not automatic: the final step. The system will ask the user to confirm installation.

About the MIME type of APK files, here's the wiki page.

Altri suggerimenti

No, in the background isn't possible without rooting or having the device's signing key at least as a standard Android APK update. The only semi-reasonable way I can envision something similar to this working is for your app to always check for/download code to run which you load using a class loader. This would be a significant amount of work and not easy.

However, if you're willing to live with some user interaction, it really shouldn't be that hard (though it'll still take some building of infrastructure). Keep a web service that returns the latest version number, compare with the current version number and download the new APK as necessary. Installing an APK programmatically has been covered in many SO questions.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top