In this example we're going to set today's NASA image of the day as our wallpaper and yesterday's image of the day as the lock screen wallpaper (lock screen wallpaper setting only works on Android 7 or above).
STEP 1 - TRIGGER TASK EVERY DAY
- Create a new profile in Tasker
- Set the Time condition
- Choose a time to make this profile trigger every day. Something like 12 PM
- Accept and create an entry task
STEP 2 - GET NASA IMAGE OF THE DAY
This is a JSON feed that contains info about a different NASA image every day
- Add an AutoTools Json Read action
- Set the Json field to https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY
If you check the JSON feed above you'll see that the hdurl field contains a link for an HD image of the day. More info about reading JSON with AutoTools here.
- Set the Fields field to hdurl
- Go back to the task and add a Flash action with the text %hdurl
- Run the task to check that the url for the image of the day shows up in the toast
STEP 3 - GETTING YESTERDAY'S DATE
These settings tell AutoTools to format yesterday's date (now minus 1 day) to the format that the NASA API expects
- Add an AutoTools Time action
- Select the Add Time section
- Enable Use Now under Date
- Set Add Unit to Days
- Set Add Value to -1
- Set Output Format to yyyy-MM-dd (case sensitive)
- Go back to the task and add a Flash action with the text %atcalulateddate
- Run the task and check that both the URL and yesterday's date show up.
STEP 4 - GET YESTERDAY'S IMAGE
You need to give the output a different name or else it would overwrite the previous %hdurl variable
- Copy the first AutoTools Json Read action and paste it at the end of the task
- Add &date=%atcalculateddate to the Json field so it's set to https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=%atcalculateddate
- Under Advanced set Variable Name to urlyesterday
IMPORTANT! Not in the video: NASA made all their images only available through https but the url in the API still returns http. Add a Variable Search Replace action where you replace http with https to make it work again.
- Go back to the task and add a Flash action with the text %urlyesterday
- Run the task and check that yesterday's url also shows up
STEP 5 - SET WALLPAPERS
- Add an AutoTools Wallpapers/Muzei action
- In the Direct Wallpaper Setting section set Wallpaper to %hdurl and Lock Screen Wallpaper to %urlyesterday
- Go back to Tasker and run the task. After a bit both wallpapers should be set to different images!
Set Home and Lock Screen Wallpapers from different NASA images of the day
Learn how to get today's and yesterday's NASA images of the day and set them as wallpapers