简体   繁体   中英

Update Android Things app via USB and package installer

Due to the shutdown of Android Things console in 2022 I would like to know if someone of you tried to update the app via USB.

I tried with no success:

First try:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(FileProvider.getUriForFile(this, this.getApplicationContext().getPackageName() + ".provider", layoutPath), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);

Result: Package installer cannot install the app due to MANAGE_UNKNOWN_APP_SOURCES. I cannot modify that flag in MANAGE_UNKNOWN_APP_SOURCES.

Second try:

Log.e(TAG,layoutPath.getPath());
Runtime.getRuntime().exec("chmod 777 " + layoutPath.getPath());
Runtime.getRuntime().exec("pm install -r " + layoutPath.getPath());

Result:

Permission Denial: runInstallCreate from pm command asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL

Do you have better ideas?

You can install or update apps on your device manually using the Android Debug Bridge (adb). Versions of your app installed using this method will override any existing version bundled into the factory image so long as you have specified a higher version .

For more details on connecting to your specific device with ADB, see the hardware guides .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM