问题
I'm currently trying to find some way of pragmatically installing updates onto a device using an Android that:
- has no means of user input
- has no internet or network
- Is running Android 4.0
This is why I am looking to do it silently. Worst case would be hooking it up to a PC every time I wish to update but this is exactly what I'm trying to avoid.
Input is from an external sdcard.
From what I've found so far there seems to a couple of ways that will, apparently, work:
- Root set the chmod to 777 on the /data/app (and not care about security)
- appbrain over the web (Useless to me)
- Write / Rewrite the OS (Past my expertise)
So my question is as follows:
What programs do I need in order to do this and how do I go about doing it?
回答1:
This is how and what I used for people that have the same problem.
- Firstly I have installed busybox (Seems I needed this to do install as both pm and adb calls didnt work)
Install Terminal Emulator (So I could check commands worked and using chmod on phone)
Run Terminal and type su -s
Now that the Terminal shows # instead of $ I can now give permission to what I need to do my install.
Now from my app I can call install using busybox.
Runtime.getRuntime().exec("/system/bin/busybox install " + ToInstall.getAbsolutePath() + " /system/app");
In my case the ToInstall is a file I have located from a device.
Note:
This installs weirdly I have to use the following to remove
rm /system/app/AppName
Also its looks weird but doesn't matter as I won't have a screen
Permission on busy box path may need to be set in order for this to work. I can do this from the terminal in su mode. 702 is said to work although I used 777 as not worried about security.
chmod 702 system/bin/busybox
来源:https://stackoverflow.com/questions/13924431/how-to-do-a-silent-install-from-inside-an-android-device-thats-rooted