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

  1. joaomgcd
    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


    (i) This is a JSON feed that contains info about a different NASA image every day
    • Set the Fields field to hdurl
    (i) 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.
    • 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


    • 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)
    (i) These settings tell AutoTools to format yesterday's date (now minus 1 day) to the format that the NASA API expects
    • 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


    (i) You need to give the output a different name or else it would overwrite the previous %hdurl variable
    • 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
    /!\ 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.


    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! :cool: