Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change android wallpaper with ADB?

Tags:

android

adb

I'd like to know if it's possible to change android wallpaper from ADB using my laptop. I don't know if exist any command for it or if I need to copy a picture into a folfer or edit a text file. I need resolve this problem with ADB if it could be.

Thanks for all

like image 871
user5217197 Avatar asked Aug 12 '15 00:08

user5217197


2 Answers

You just need to launch the proper wallpaper-setting intent, handled by one of the (several likely) installed apps that have registered to receive it:

adb shell am start \
    -a android.intent.action.ATTACH_DATA \
    -c android.intent.category.DEFAULT \
    -d file:///path/to/my/image/on/device.jpg \
    -t 'image/*' \
    -e mimeType 'image/*'

If you need to upload it to your device first (bash syntax):

file=/tmp/test.jpg
dest=/sdcard/Download/"${file##*/}"
adb push "$file" "$dest"
adb shell am start \
    -a android.intent.action.ATTACH_DATA \
    -c android.intent.category.DEFAULT \
    -d file://"$dest" \
    -t 'image/*' \
    -e mimeType 'image/*'
like image 164
Stephen Talley Avatar answered Sep 19 '22 11:09

Stephen Talley


Wallpapers are setup via your Home application. This could be literally any app and thus no general adb command exists.

I know apps like Trebuchet (old launcher used by default in Cyanogenmod) loads information from XML/JSON files so you might be able to push images/configuration files and trigger a reboot, but it'll be specific to the home app you are using. So you'll have to figure out which app you are using and if any external configuration files exists that you can modify.

EDIT

I would write a small Android app that uses a BroadcastReceiver or deeplink to an activity that listens for a specialized Intent. The intent would include data with a location to a file to use as the wallpaper. Then write code within the app that sets the wallpaper programatically. See Programmatically set android phone's background for help on that part. You can then send an intent via adb (see Sending intent to BroadcastReceiver from adb) that your code will be listening for and that would trigger updating the wallpaper. I'm not going to go into detail on how to implement that, but hopefully provide you with enough search terms to know how to implement it yourself.

like image 36
zerobasedindex Avatar answered Sep 21 '22 11:09

zerobasedindex