2

I have been looking into silent installing for a while now.

I'm currently trying to find some way of installing updates onto a device using 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.

My idea is that the only input I have to this device is my SD card.

What I need to be able to do is constantly look for a file on the SD card; if it's there then I will update the software on the device without any user input (apk or a suggested file type).

From what I've found so far there seems to a couple of ways that will, apparently, work:

However, I would prefer to not have to root the device until I can get some feedback from people that know a bit more than me.

So my questions are as follows:

  • Can anyone tell me if one of these methods will work for my case? (80% chance will do)
  • Is there another way that I have missed in my searches that someone can point out?
Community
  • 1
  • 1
SatanEnglish
  • 1,346
  • 1
  • 13
  • 22
  • Hmm got closed? **Could you tell me why you decided to close my question** I could of edited it if someone would tell me what I have apparently not included or overly included. As I said I am new to programming and also if you look at my Standing you can see this is my first ever post! Pointers would be great or if someone could reopen and tell me what I need to change that would be great – SatanEnglish Dec 03 '12 at 20:26
  • Probably closed because it's just too difficult a problem for most people here to understand how to approach it. You could do something like trigger off the SD card insertion with an intent, pm install what you find there (assuming root), but a tricky part is that you really are supposed to unmount the sdcard before ejecting it, so you'd need to force that - and then make some noise or flash a light to tell the user it's okay to remove. Or take your (admittedly slim) chances on corrupting the card, on the assumption that you will reformat the sdcard before using it again. – Chris Stratton Dec 03 '12 at 21:27
  • A cleaner idea might be to setup the recover system to read an update.zip off the sdcard, and have an app that detects sd card insertion and reboots into recovery. For a custom device without a network, making reboot setuid might be tolerable... as an alternative to having a generic 'su' hack. And you can require a signature on the update.zip. – Chris Stratton Dec 03 '12 at 21:32
  • AIED will require user confirmation to install anything - it's effectively the same as pointing a browser or file manager at the just compiled apk. – Chris Stratton Dec 03 '12 at 21:39
  • Hay chris so what I'm am more likely to be using a usb stick. The idea is to make is easy for anyone (give them the new update for them to put on a usb stick). Not so worried about corruption with this as: Some install is done to stick that will wipe and replace apk with new apk. Also im going to have the program cycle in the background to determine when the usb is input and check for new Updated version (likely by number in name or something simple). – SatanEnglish Dec 03 '12 at 21:47
  • Also with the AIED is just at the moment me clutching at straws as I said very new to this. The main thought with the AIED was that if running in debug mode I could install items without permission (Haven't had a chance to see if this works been to busy as of yet). However this would assumes that the device is not turned off. Although less user input seems need to auto run the program than it is for installing hence my consideration of this approach – SatanEnglish Dec 03 '12 at 21:52
  • No, you cannot install without user confirmation from an app (AIDE or one of your own), unless you have a root hack or you built the system image and made that app a system app. – Chris Stratton Dec 03 '12 at 21:59
  • thanks chris will keep looking into this and update this post even if it is currently closed – SatanEnglish Dec 03 '12 at 22:17
  • Hi, I've tried to make your question slightly less discursive but am finding it difficult as this is basically what your question is; a discussion around what should be done. You have definitely done your homework and it's a perfectly fine topic for SO but there's little in the way of actual doing, which explains both the closure and the the close reason. I have added my vote to reopen your question on top of everyone else's so you're only one vote away from your question being reopened. – Ben Dec 03 '12 at 23:11
  • **However** if you don't make this question less like a discussion and more like an answerable question (maybe remove the last two questions?) then I doubt this will stay open for long. Closure is meant to be a temporary state to enable you to improve your question. There isn't much evidence of you doing this. I would highly recommend that you read the [faq] and [this blog post](http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx) to see what I mean. You are of course able to do neither :-) but it might make your use of SO more enjoyable. – Ben Dec 03 '12 at 23:14
  • Thanks for your input Ben I have been editing it and will as you have suggested remove at least 1 of the 2 questions as I still would like to Know if someone finds another answer. Also thanks for the link was searching for some idea on how to format ect – SatanEnglish Dec 03 '12 at 23:36
  • There can be no non-interactive upgrade mechanisms for 3rd party apk's under the current android security model. So your options are basically to change the security model, be a first party (system vendor / certificate holder) or upgrade dynamic classes or native libraries that are not actually in an apk. – Chris Stratton Dec 05 '12 at 01:57
  • Thanks think I'm just going to go with Root and pretend I'm an ADB program. This seems the least likely to break for me as a new programmer. – SatanEnglish Dec 05 '12 at 02:07
  • For anyone that wants the answer I have answered it here [OtherPost](http://stackoverflow.com/questions/13924431/android-how-to-do-a-silent-install-within-android/13924543#13924543) – SatanEnglish Dec 18 '12 at 00:31

1 Answers1

0

You can use the Packagemanager commmand of the prompt for doing this..

Example:

su -c pm install <apk>

From your application you can:

Process p = Runtime.getRuntime().exec("su -c pm install " + <your apk>);

Note:

  • You should have at least shell root access if you want install silently
  • If you do not have shell root access then a pop-up will be shown to the user

Update Sorry for my ignorance, but I guess root is your only option. The far fetched ideas seem they might work but as I have not done it myself I do not know.

Bhuvan
  • 285
  • 1
  • 3
  • 11
  • this will, rather obviously, not work, as pm will run with the restricted permissions of the application. – Chris Stratton Dec 03 '12 at 04:19
  • as chris has just said this will not work. Are you assuming that the pm has completely been rewritten? This post has tried to be a pacific as possible so that the answers would come back in a likewise format. Also what parts of the post are your answers addressing? Also what else are you assuming here that its already chmod 777 my programe?? (Thanks for input) – SatanEnglish Dec 03 '12 at 04:41
  • This modified form of this *might* do what it intends to if there's an su executable usable by non-root users, which accepts a command to execute as an argument. Either part of that can be untrue on many devices. – Chris Stratton Dec 03 '12 at 21:25
  • For anyone that wants the answer I have answered it here [OtherPost](http://stackoverflow.com/questions/13924431/android-how-to-do-a-silent-install-within-android/13924543#13924543) – SatanEnglish Dec 18 '12 at 00:32