Dismiss Alarm By Disconnecting Watch From Charger

You'll learn how to dismiss the current alarm, unlock your screen and open your favorite news app si

  1. joaomgcd
    STEP 1 — SCREEN UNLOCKING SCENE



    (i) We're first going to create a Tasker scene whose only purpose is to help us unlock the screen. If you have security on your screen, you'll have to manually unlock it, or follow this if you are rooted
    • Tap the Scenes tab in Tasker
    • Tap the plus icon below
    • Make the scene as small as you can
    • Exit the scene editor to save it




    STEP 2 — DISCONNECTED EVENT


    • Click the Profiles tab and create a new profile with the plus sign below
    • Select Event->Plugin->AutoWear and edit the condition
    • Under "Event" select "Power Disconnected"
    • Accept these settings and create a new Task




    STEP 3 — CHECK ALARM NOTIFICATION


    • In the task add a Plugin->AutoNotification->Query action
    (i) We are now querying the system to see if an Alarm notification exists, so we're going to make AutoNotification look for notifications from the "Clock" app that have the title "Alarm"
    • Set "App Name" to "Clock
    • Set "Title" to "Alarm"
    • Accept these settings and go back to the task

    STEP 4 — IF IT'S THE RIGHT NOTIFICATION...



    (i) When you query your notifications you get back lists of results. Each of the items in these lists correspond to a notification. Because we narrowed it down to the Clock app and to the "Alarm" title, we're pretty certain that if the notification exists, it'll be the first one, so we'll access position 1 in the lists.

    (i) We need to only proceed if the notification exists in the first place, so lets check if the action for Button 2 is set. Button 2 is the "Dismiss" button on the Alarm notification.
    • If the action is not set, that means that the notification doesn't exist
    • Add an "If" action
    • Set the condition to "%anbutton2action1 Is Set"
    (i) The 1 at the end of "%anbutton2action" means that we're accessing position 1 of the list​




    STEP 5 — CLOSE IF


    • Add an "End If" action so that the "If" is properly closed




    STEP 6 — CLICK DISMISS BUTTON



    (i) We're now going to "click" on the dismiss button of the alarm's notification with AutoNotification
    • Add a new Plugin->AutoNotification->Actions action
    • Set "Intercept Action ID" to %anbutton2action1
      • %anbutton2action1 is the action that corresponds to the second button in the Alarm notification, which is "Dismiss"
    • Accept these settings and go back to Tasker





    STEP 7 — SHOW SCENE TO UNLOCK



    • Add a "Show Scene" action between the "If" and "End If"
    • Select the "Small Popup" scene you created before
    • Set it to appear as a Dialog
    • Make it appear at the top left of your screen
    • Set animation to Scale
    (i) Showing this scene will make your screen unlock but won't show any ugly popups on the screen. That's why we're keeping it out of sight.




    STEP 8 — LAUNCH NEWS APP



    • Add a App->Launch App action
    • Select your favorite news app




    STEP 9 — DESTROY SCENE


    • Add a 3 second wait action
    (i) If you don't wait and dismiss the scene right away, you won't give it enough time to unlock your screen and the screen will remain off
    • Add a "Destroy Scene" action.




    STEP 10 — TEST IT


    • Test it! Set an alarm and wait for it to appear.
    • Press the play button in the task.
    (i) The alarm should now be cancelled and your favourite news app should open.