Get Text from Non-Standard Notifications

Learn how to get notification texts from notifications that use different layouts, like Google Maps

  1. joaomgcd
    Some apps like Google Maps create notifications that don't look like normal notifications.

    [​IMG]

    These don't have a regular title and text like normal notifications do but use a totally customized layout instead.

    Luckily you can still get all info out of the notification. Follow the procedure below.

    STEP 1 - CREATE GET ROUTE INFO TASK


    • Open Tasker
    • Create a new Task
    • Name it Get Route Info


    STEP 2 - GET ALL TEXTS FROM NOTIFICATION


    • Add an AutoNotification Query action to the task
    • Edit it
    • Select the option to only get notifications from the Maps app
    • Tap Advanced
    • Select the Get All Fields option
    (i) This will make AutoNotification get all the image and text fields in the notification and return it in a Tasker array. This way, the notification can have any layout and it should always work.
    • Go back to Tasker and add a Flash action
    • Write %antextsbig()
    (i) If you notice, the notification has different info when it's in its small and big version. The big version has the info we want so we're going to get those fields.
    • Test the task. You'll get a flash of all the text that's present in the expanded version of the notification
    (i) Notice how the first element in the flash (separated by commas) is the distance to the next turn, the second one is the time to the next turn and the third is the general route info. We're going to use this in the next step


    STEP 3 - GET SPECIFIC FIELDS


    • Go back into the AutoNotification Query action
    • Tap Advanced again
    • Edit the Big Text Names field
    • Set its value to nextdistance,nexttime,routeinfo
    (i) This will make AutoNotification name the first available field %nextdistance, the second one %nexttime and the third %routeinfo so that we have easy access to the variables with custom names.
    • Go back to Tasker and add these variables to the existing flash action
    (i) If you now test the task you'll see that the values are separated correctly with the created variables


    STEP 4 - GET ROUTE DETAILS


    • Add an AutoTools Regex action to the Task
    • Set the Text field to %routeinfo
    • Set the Regex field to (?<routedistance>[\d\s\.km]+).+(?<routeeta>[\d]+:[\d APM]+)
    (i) This regex will parse the route info and create variables called %routedistance and %routeeta from it with the desired values
    • Go back to Tasker and add these new variables to the flash as well
    • Make the Flash action be the last one in the Task
    (i) If you now test the task you'll see that you'll have variables with all the info you may need.



    You can now use this info to send an SMS message to someone for example, or to read it out loud with a Say action. You can do with it whatever you want! As always, that's the beauty of Tasker! :cool:

Recent Reviews

  1. ChrisWithAutoApps
    ChrisWithAutoApps
    5/5,
    This is a super easy way to send ETA updates.