Sometimes you want to click on a button in a notification that you receive, but sometimes you may want to click on a notification that already exists.
For example, you may be listening to a song on Google Play Music and want to thumbs up it.
STEP 1 - PLAY SOME MUSIC
- Open Google Play Music
- Play a song
- Go back to your home screen so that a notification for Google Play Music is created
STEP 2 - CREATE THUMBS UP TASK
- Create a new Task in Tasker
- Call it Thumbs up
STEP 3 - QUERY GOOGLE PLAY MUSIC NOTIFICATION
Depending on the notification you're intercepting you may want to specify other criteria to make sure you get the right notification. In this case we're sure there's only 1 Google Play Music notification so it's simple to get it
- Add a new AutoNotification Query action
- Choose to only query notifications from Google Play Music
- Accept settings and go back to Tasker
STEP 4 - SHOW NOTIFICATION ACTION
The Google Play Music notification has 5 action buttons. The one we're interested in is the first one, so we're going to use the %anbutton1action variable. If you wanted to press other buttons you would use %anbutton2action, %anbutton3action, etc.
Because an AutoNotification Query action can return multiple notifications, all the variables it produces are arrays (multiple values). In this case, we're sure there's only 1 notification, so we always get the first value, which we do by using (1) at the end of the variable name
- Add a Flash action
- Set the text to %anbutton1action(1)
You should see a toast with an ID show up. This ID represents the button action's unique ID.
- Accept, go back to Tasker and run the task
STEP 5 - PERFORM BUTTON ACTION
This will actually perform the action contained in the first button of the Google Play Music notification
- Add an AutoNotification Actions Tasker action
- Use the %anbutton1action(1) in the Intercept Action ID field
STEP 6 - TEST
If you now run the Task you'll see that it's toggling the Thumbs Up on Google Play Music for this song!