[Tasker Tips & Tricks] MishaalRahman:
If you don't have a bluetooth speaker in your car capable of answering phone calls or texts, and if you drive a lot you'll find yourself needing a way to respond to important messages without distracting yourself too much. Thanks to Tasker, you can make it so that you are prompted to respond to calls/texts and read notifications.

Prerequisites

Root Access to automatically answer calls

Secure Settings plugin

AutoNotification or Notification Listener to grab the notification text

We'll be making three profiles as a part of our driving mode setup. First up, an incoming call profile.

Instructions

First profile you will make should be called "Driving Mode - Incoming Call"

Create an Event context, go to Phone --> Phone Ringing. Leave the caller field blank. Exit out, and create a new task. You can name it if you want, but it's not necessary.

Once inside the task, your first action will be to create a Say command. Go to Alert --> Say. For the text you want the TTS to say, type in something like

Incoming call from %CNAME would you like to answer?

I would recommend you uncheck "Respect Audio Focus" so Tasker notifying you of a call will take precedence over whatever other audio is playing from your phone.

Input --> Get Voice. Go to Label and make it "DECIDE". You will come back to this action with a Goto later.

Task --> If. Set it to if %VOICE ~ Yes. Basically, if you saw "yes" then you've chosen to answer the call.

Plugin --> Secure Settings. Root Settings --> Phone Options. Pick "Answer Call."

Audio --> Speakerphone. Set it to On.

Task --> Else If. Set it to if %VOICE ~ No. This is if you choose to not answer the call.

Plugin --> Secure Settings. Root Settings --> Phone Options. Pick "End Call."

OPTIONAL: Phone --> Send SMS. Number should be %CNUM. Send a message with whatever you want telling them you're busy, for instance:

I am currently driving. I will respond back to you as soon as I am able. Thank you.

Task --> Else

Task --> Goto. Set type to "Action Label." Go to label "DECIDE" which is Action Number 2.

Task --> End If

Exit out, and finally, you will need to add one more context to the profile in order to ensure that this profile ONLY runs when you are actually driving. One way you can do this is to create a context connected to your car's bluetooth, you can make a shortcut on your homescreen to turn the task on/off when you get in the car, you can scan an NFC tag, you use location geofences ala AutoLocation, etc. For me, I use an NFC tag.

Here are screenshots of the task:

Next up, the notification reader:

Create a new Profile and title it "Driving Mode - Read Notification"

Create an Event context, go to Plugin --> AutoNotification and pick Intercept. Go to the apps to intercept and select only the apps that produce notifications that you think are important enough to bother you while driving. I'm sure you're not interested in knowing you're being invaded in Clash of Clans while driving....right?

Exit and create a task. Name it anything.

Alert --> Say. For the text, put %antitle. Check If and make it if %antitle is Set.

Alert --> Say. Make the text %antext. Check If and make it If %antext is Set.

Alert --> Say. Make the text %ansubtext. Check If and set it to If %ansubtext is Set.

If you are using Notification Listener instead, simply change %antitle to %nltitle, change %antext to %nltext, and change %ansubtext to %nlsubtext.

Exit out, and finally, you will need to add one more context to the profile in order to ensure that this profile ONLY runs when you are actually driving. One way you can do this is to create a context connected to your car's bluetooth, you can make a shortcut on your homescreen to turn the task on/off when you get in the car, you can scan an NFC tag, you use location geofences ala AutoLocation, etc. For me, I use an NFC tag.

Here is a screenshot of the task:

Finally, a text message response profile:

Create a new profile and name it "Driving Mode - Read Text."

Go to Event --> Phone --> Received Text. Make the Type Any and leave everything else blank.

Now, we'll create the task. Leave the name blank.

Alert --> Say. Make it say the following:

%SMSRN says %SMSRB. Would you like to respond?

Input --> Get Voice. Label it "REPEAT".

Task --> If. Set it to if %VOICE ~ Yes.

Input --> Get Voice. Label it "AGAIN."

Variables --> Variable Set. Set name to %voice and set it to %VOICE.

Alert --> Say. Make the text this:

%VOICE. Is this okay?

Input --> Get Voice.

Phone --> Send SMS. The number should be set to %SMSRF. Go down and add an If statement to this task, and set it to If %VOICE ~ Yes

Task --> Goto. Set the type to "Action Label" and set the label to "AGAIN."

Task --> Else If. Set it to if %VOICE ~ No

Phone --> Send SMS. Set the number to %SMSRF. Make the message something like this:

I am currently driving. I will respond back to you as soon as I am able. Thank you.

Task --> Else

Task --> Goto. Set type to "Action Label" and make the label "REPEAT."

Task --> Else If.

Here are screenshots of the task:

And that's it! Enjoy the profiles and let me know. I've attached the XMLs below you can import by moving them to /sdcard/Tasker/Profiles and then long-pressing on the Profiles tab up top while in Tasker and clicking on Import.