There is a tutorial made by Joao Dias showing you how to set NASA daily pictures as wallpaper. I thought, I would up the ante a little. When I started to work on this project, I thought it will be a quick one. Turned out, the solution was more difficult than initially anticipated. A 5 min tutorial turned into a several hours long mad googling session! I REALLY hope you will like the Google Maps traffic wallpaper.
Without further introductions, here is Google Maps traffic wallpaper. This wallpaper is set for a period of time before commute to and from work. Could you just ask Google for this information? Yes, you can do that, however, I find this to be less intrusive, you don’t have to think about it and the information is ready when you need it most. It’s a great addition to your Google Now updates.
Map – the issue
The information is best obtained by taking a screenshot. This is not that simple if your phone has a screen lock on it. I can force the Tasker to take the screenshot – whether with a Run Shell, AutoTools etc. But most of the time I would end up with a black screen, or lock screen picture.
I had to scrap this idea and come up with something else. While googling for solutions I came across screenshot services like screenshotmachine.com. The free account allows you for a 100 API calls per month. The API is pretty much self-explanatory. I got stuck for a long time with the fact that my link was able to pull a correct image via the web browser but not through the HTTP GET action. I managed to bypass the link issue by using the Google URL shortener. It worked.
The context is simple (feel free to change it). I’m using a time condition to change the current wallpaper for 30 min before my commute to work, and before my return home. Outside of these times, the wallpaper will revert to one of your choices. You can use the Tasker to set the wallpaper, and if you on Android 7 you can use AutoTools to set the screen lock wallpaper separately.
Formatting the link
As per API guide, the link looks like this:
Open up the google maps and get the directions for your commute (both ways) and cut the link short before the encoded part. (The link has been updated with the &cacheLimit=0 to prevent the request from getting the cached image – credit: Zach Paiz) Here is my example and here is where it ends (remove stuff associated with/data=!3m1…. these are the time of travel and we want to have this generated each time):
https://www.google.co.uk/maps/dir/Field+View+B+%26+B+Yarm,+Green+Lane,+Yarm+TS15+9EH,+United+Kingdom/Manchester+Piccadilly+Station,+Manchester+M60+7RA,+United+Kingdom /(dont need the rest)....../data=!3m1!4b1!4m13!4m12!1m5!1
Use that google code with the URL shortener if it doesn’t work directly for you to compile the final screenshot API request. I’m going to use HTTP GET to receive the picture of the current traffic and route options. As both routes will use exactly the same routines but different links it makes sense to set the shortened links as variable %UrlCommute. In the action set the link + the variable in the Server:Port. Set the Mime Type to Image/png and select a file location. This is where the picture will be stored. Before the image can be used – we will need to crop it.
If you selected the image to be full size (X) you will end up with a consistent image of 1024 x 768px. This is far from perfect and the crop is in place. You can use both information if you wish. The list view and the map view but I will show you the cropping to get the map. You will need 3 actions. Load, Crop and Save image. Crop from the left 45%.
Using Muzei and AutoTools you can set the new wallpaper to both home screen and lock screen. If you are using Tasker actions only you will be limited to a home wallpaper only. Select the correct files and you are ready to rock.
Finishing the project Google Maps traffic wallpaper
After reading all this, I’d assume you will have no problem with setting up a profile for the reversed journey. You don’t even have to change the file names. only reverse the link and set up a new time.
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.