Tag Archives: Tasker

How To Automatically Select Random Google Wear Android Watch Faces

Say you’re an aficionado of novelty like I am, but you also don’t like being overwhelmed by the paradox of choice when it comes to the myriad Google Wear watch faces. I have a huge array of Android watch faces installed, and I would like to have a way to randomly select a new watch face every day. To automatically select a random Google Wear Android watch face, you just need to have the Tasker app installed on your primary Android device with the AutoInput plugin also installed.

Once those prerequisites are met, you can create a task in Tasker called “Switch Watchface” and populate it with the following code:

A1: Array Push [ Variable Array:%watchfaces Position:9999 Value:/*ENTER THE NAME OF THE WATCH FACE HERE*/ Fill Spaces:Off ]
A2: Array Push [ Variable Array:%watchfaces Position:9999 Value:/*USE AS MANY 'ARRAY PUSH' LINES AS YOU HAVE WATCH FACES YOU WANT TO SELECT FROM*/ Fill Spaces:Off ]
A3: Variable Set [ Name:%count To:%watchfaces(#) Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ]
A4: Variable Randomize [ Name:%random Min:1 Max:%count ]
A5: Variable Set [ Name:%watchface To:%watchfaces(%random) Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ]
A6: Popup [ Title: Text:Switching watch face to %watchface Background Image: Layout:Popup Timeout (Seconds):1 Show Over Keyguard:On ]
A7: Launch App [ Package/App Name:Android Wear Data: Exclude From Recent Apps:Off Always Start New Copy:On ]
A8: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A9: AutoInput Action [ Configuration:Type: Text
Value: More
Action : Click Timeout (Seconds):23 ]
A10: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
<check if on screen>
A11: AutoInput UI Query [ Configuration:Variables: faces() Timeout (Seconds):20 ]
A12: If [ %faces(#?%watchface) eq 0 ]
A13: Flash [ Text:Didn't find %watchface. Scrolling... Long:Off ]
A14: AutoInput Action [ Configuration:Type: Id
Value: com.google.android.wearable.app:id/watch_face_inner_frame
Action : Scroll Forward Timeout (Seconds):20 ]
A15: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A16: Goto [ Type:Action Label Number:1 Label:check if on screen ]
A17: Else
A18: Flash [ Text:Found %watchface. Switching to it! Long:Off ]
A19: End If
A20: AutoInput Action [ Configuration:Type: Text
Value: %watchface
Action : Click Timeout (Seconds):20 ]
A21: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A22: AutoInput Action [ Configuration:Type: Text
Value: Set on watch
Action : Click
Is Tasker Action: false
Check Screen State: false Timeout (Seconds):1 Continue Task After Error:On ]
A23: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A24: Go Home [ Page:0 ]

What this task does is it creates an array populated by the names of each watch face to be selected from. Then it creates a variable %count whose value is the number of items in the array. Then it creates a %random variable with a value of a randomized number between 1 and the value of %count.  With as the random number selected, it assigns the %watchface variable the name of whichever watch face is located at that position in the array.

With a %watchface defined, Tasker launches the Android Wear app, looks for the word “More” on the screen, taps it to bring up the list of watch faces, looks for the name of the watch face (it’s important that the %watchfaces array is populated by exact matches, otherwise Tasker will not find them!), taps the menu icon for the watch face, then taps “Set on watch”, setting the watch face.

If Tasker doesn’t find the name of the watch face, it will automatically scroll, looking for the name of the face.

Once the watch face has been set, Tasker will exit the app back to the home screen. The whole process takes about 5 seconds or so, depending on how many times Tasker has to scroll.

For your convenience, I have saved this task as an XML file that can be directly imported into Tasker. You can download that file here.