Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add Intent to trigger restore #40

Open
jas4711 opened this Issue · 2 comments

2 participants

@jas4711

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. :-)

@jensstein
Owner

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.

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.

@jas4711

It seems like receiving intent can be conditioned on having some permissions, see:

http://developer.android.com/reference/android/content/BroadcastReceiver.html#Security

Quoting:

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
receiver.

I'm not sure how to acquire such a permission from 'am broadcast' though... maybe being root is sufficient.

/Simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.