Domanda

OK,

I know there are are a fair number of questions similar to this, but non have given me the answer I'm looking for.

I have a custom rooted ROM (without play store). It's a android stick pc (So I don't have the system key to sign my app with, unless I've missed something in the kernel docs). I want my app to check nightly for updates from my server. If there is a new version I want it to download and install it without user interaction.

I know I can trigger the update screen with

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(new File(pathToApk));
intent.setDataAndType(uri, "application/vnd.android.package-archive");
startActivity(intent);

But as I said it's not what I want. SU and busybox are on the device. Anyone know of a way to do this?

È stato utile?

Soluzione

You can access the PackageManager from the command line using pm. If su is present, you need to run

su pm install pathToApk.apk

To run it from a Java application, use ProcessBuilder.

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