I want to script re-installing my phone as much as possible, and one of the manual steps right now is starting oandbackup and selecting the apps to restore and clicking go.
In email, you suggested that one approach would be to use Intents to trigger this. I think this seems like a good approach: have an Intent to trigger restore of all apps in the configured path.
Then my script to automate re-install of my phone could be something like:
adb install dk.jens.backup-1.apk
adb push oandbackups /sdcard/oandbackups
adb shell am ... # trigger intent here
This issue is to make it easier to track progress around this. :-)
i have considered having this for some time, and my first thought would be to do it via intents.
different options could then be exposed via extras and called with something like am broadcast -a dk.jens.backup.INTENTNAME -e mode restore -e dirpath /sdcard/backups -n dk.jens.backup/.Receiver
but since i never automate things like this myself, i would very much appreciate any input from others who do.
am broadcast -a dk.jens.backup.INTENTNAME -e mode restore -e dirpath /sdcard/backups -n dk.jens.backup/.Receiver
a security issue to consider here (if we go with intents) is how best to set up permissions for the broadcastreceiver. it needs to be permissive enough to be actually useable, but it probably wouldn't be a good idea to just let everybody (every other app, that is) send an intent to e.g. restore all apps.
It seems like receiving intent can be conditioned on having some permissions, see:
To enforce a permission when receiving, you supply a non-null permission when registering your receiver --
either when calling registerReceiver(BroadcastReceiver, IntentFilter, String, android.os.Handler) or in the static
tag in your AndroidManifest.xml. Only broadcasters who have been granted this permission (by
requesting it with the tag in their AndroidManifest.xml) will be able to send an Intent to the
I'm not sure how to acquire such a permission from 'am broadcast' though... maybe being root is sufficient.