Some apps like Google Maps create notifications that don't look like normal notifications.
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
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.
- 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
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.
- Go back to Tasker and add a Flash action
- Write %antextsbig()
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
- Test the task. You'll get a flash of all the text that's present in the expanded version of the notification
STEP 3 - GET SPECIFIC FIELDS
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 into the AutoNotification Query action
- Tap Advanced again
- Edit the Big Text Names field
- Set its value to nextdistance,nexttime,routeinfo
If you now test the task you'll see that the values are separated correctly with the created variables
- Go back to Tasker and add these variables to the existing flash action
STEP 4 - GET ROUTE DETAILS
This regex will parse the route info and create variables called %routedistance and %routeeta from it with the desired values
- 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]+)
If you now test the task you'll see that you'll have variables with all the info you may need.
- 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
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!
Get Text from Non-Standard Notifications
Learn how to get notification texts from notifications that use different layouts, like Google Maps