[GUIDE][Difficulty: Beginner] Prompt to add Previous Caller as Contact

Search This thread

MishaalRahman

Editor in Chief
Nov 2, 2015
1,039
2,120
www.xda-developers.com
Do you find yourself annoyed having to manually add someone as a contact after receiving a phone call from them? Would you rather be prompted with the option to add them as a contact before you fumble going through the proper menus? This short tasker task will do just that for you, using the power of intents.

Prerequisites

  1. OPTIONAL: Snackbar Tasker Plugin to make a neat prompt asking you to add the previous caller as a contact

Instructions

  1. Click + to create a new Profile and name it "Add Contact" or anything else you want.
  2. Choose a "State" context, go to "Phone" and select "Call." Set the Type to "Incoming" and leave the Number field blank.
  3. Back out, and name the task that pops up whatever it is you want.
6ebqoKu.jpg


Here's what your Profile should look like. Now, let's move on to the task itself.

  1. Task --> If. For the first condition, put %CNAME ~ %CNUM. This checks whether or not the previous caller already has a set name by comparing it to the phone number they called from. If the two match, then that means the contact is not recognized. Press the + icon to create another Condition, and make sure that the two Conditions are linked by an And. For the second Condition, set it to %CNUM !~ 0. This checks to see if the previous caller was an unknown/private number, and if so, you won't be prompted to add them as a contact.
  2. OPTIONAL: Plugin --> Snackbar Tasker Plugin. Select a "Bottom Sheet". Enter the configuration for the snackbar, and enter a title for the dialog that will pop-up (I put "Add caller as contact?"). Under "Items to appear in sheet separated by ","" put down Yes,No. Under "Commands to be sent separated by "," enter yes,no. Take note that there should be NO space between the comma. For the color name fields, enter the hex name for however you want the snackbar to be themed. When you're done, exit out by pressing the checkmark, then press the back key when you're back inside Tasker.
  3. System --> Send Intent. Under Action put in android.intent.action.INSERT For Cat, leave it at None. For the Mime Type, type in vnd.android.cursor.dir/raw_contact. Next, for the first Extra field type in phone:[%CNUM] Finally, scroll down to Target and select Activity. If you followed the optional step above to make a snackbar, then under If set the condition to %bs_command ~ yes. This means the intent will only be sent if you select yes when the snackbar pops up after a phone call.
  4. Task --> End If
ez8AX0v.jpg


That's it! Let me know if there are any suggestions you would make.
 

Attachments

  • Add_Contact.prf.xml
    15.2 KB · Views: 3,436
Last edited:

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
Do you find yourself annoyed having to manually add someone as a contact after receiving a phone call from them? Would you rather be prompted with the option to add them as a contact before you fumble going through the proper menus? This short tasker task will do just that for you, using the power of intents.

Prerequisites

  1. OPTIONAL: Snackbar Tasker Plugin to make a neat prompt asking you to add the previous caller as a contact

Instructions

  1. Click + to create a new Profile and name it "Add Contact" or anything else you want.
  2. Choose a "State" context, go to "Phone" and select "Call." Set the Type to "Incoming" and leave the Number field blank.
  3. Back out, and name the task that pops up whatever it is you want.
6ebqoKu.jpg


Here's what your Profile should look like. Now, let's move on to the task itself.

  1. Task --> If. For the first condition, put %CNAME ~ %CNUM. This checks whether or not the previous caller already has a set name by comparing it to the phone number they called from. If the two match, then that means the contact is not recognized. Press the + icon to create another Condition, and make sure that the two Conditions are linked by an And. For the second Condition, set it to %CNUM !~ 0. This checks to see if the previous caller was an unknown/private number, and if so, you won't be prompted to add them as a contact.
  2. OPTIONAL: Plugin --> Snackbar Tasker Plugin. Select a "Bottom Sheet". Enter the configuration for the snackbar, and enter a title for the dialog that will pop-up (I put "Add caller as contact?"). Under "Items to appear in sheet separated by ","" put down Yes,No. Under "Commands to be sent separated by "," enter yes,no. Take note that there should be NO space between the comma. For the color name fields, enter the hex name for however you want the snackbar to be themed. When you're done, exit out by pressing the checkmark, then press the back key when you're back inside Tasker.
  3. System --> Send Intent. Under Action put in android.intent.action.INSERT For Cat, leave it at None. For the Mime Type, type in vnd.android.cursor.dir/raw_contact. Next, for the first Extra field type in phone:[%CNUM] Finally, scroll down to Target and select Activity. If you followed the optional step above to make a snackbar, then under If set the condition to %bs_command ~ yes. This means the intent will only be sent if you select yes when the snackbar pops up after a phone call.
  4. Task --> End If
ez8AX0v.jpg


That's it! Let me know if there are any suggestions you would make.

Very nice, except I will never get this typed-in. Maybe publish the script that can be downloaded and inserted from tasker.
 

AKW

Senior Member
Oct 6, 2015
597
571
Jacksonville
I notice that when I click "Yes" to add the caller as a contact, the phone number comes in the format [##########] with the brackets around it. Is there a way to make it come in the format +1 ###-###-#### ?
 

MishaalRahman

Editor in Chief
Nov 2, 2015
1,039
2,120
www.xda-developers.com
I notice that when I click "Yes" to add the caller as a contact, the phone number comes in the format [##########] with the brackets around it. Is there a way to make it come in the format +1 ###-###-#### ?


The default intent action requires it to be formatted as such, as anything else simply makes the PHONE field end up as blank (not sure why). However, you can use AutoShare's intent builder with this intent in order to get around this. Credits to redditor /u/YoungKnave for this intent. You download this, import it into AutoShare, then inside Tasker rather than sending an intent through itself you would go to Plugin --> AutoShare and select the intent you imported. Then for the phone number, put %CNUM. I found that doing it this way properly formats it, however I didn't mention it above because AutoShare isn't a free app.
 
  • Like
Reactions: hrk7474 and AKW

AKW

Senior Member
Oct 6, 2015
597
571
Jacksonville
The default intent action requires it to be formatted as such, as anything else simply makes the PHONE field end up as blank (not sure why). However, you can use AutoShare's intent builder with this intent in order to get around this. Credits to redditor /u/YoungKnave for this intent. You download this, import it into AutoShare, then inside Tasker rather than sending an intent through itself you would go to Plugin --> AutoShare and select the intent you imported. Then for the phone number, put %CNUM. I found that doing it this way properly formats it, however I didn't mention it above because AutoShare isn't a free app.

Understood. I'll look into it. Thank you, sir.
 

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
It's a profile so it should go in the profile folder. To import a profile, you long-press on the "PROFILES" tab up top.
Found the profiles folder and moved it to there and was able to import it (one thing about tasker are all those non-intuitive, even hidden functions to try out, somehow :))

Needs a Bottom Sheet and an AutoShare plugin. What do I install? A lot of plugins with paid additions by one author.
 

arbolarc

Member
Jan 8, 2015
39
3
I tried this but I keep getting red marks on the if statement. Is there something I did wrong? Also, I couldnt download the file. How do I download it?
Thanks
 

Attachments

  • Screenshot_2016-03-08-23-29-24.png
    Screenshot_2016-03-08-23-29-24.png
    84.5 KB · Views: 243

MishaalRahman

Editor in Chief
Nov 2, 2015
1,039
2,120
www.xda-developers.com
Found the profiles folder and moved it to there and was able to import it (one thing about tasker are all those non-intuitive, even hidden functions to try out, somehow :))

Needs a Bottom Sheet and an AutoShare plugin. What do I install? A lot of plugins with paid additions by one author.

Snackbar Tasker Plugin and AutoShare are completely optional for this profile. The XML I attached uses it because I have paid for it and already use it frequently, but if you follow the instructions I've written above then you do not need to use either.

It might seem odd, but once you get into Tasker you will notice a recurring name in the most frequently recommended plugins: joaomgcd. This guy is a wizard at Tasker, and has made dozens of Tasker plugins. While you CAN do things without his plugins (as I've written) it does make things neater and simpler. It's up to you though.

I tried this but I keep getting red marks on the if statement. Is there something I did wrong? Also, I couldnt download the file. How do I download it?
Thanks

The red marks are fine. They simply mean that RIGHT NOW if you were to run the task it would fail the If statement. Meaning, the last phone call you had was from a recognized phone number, hence Tasker would fail this condition since it should only fire when the previous caller is not a recognized contact.

Ok, most stupid question ever. Where do i get the tasker from?

There are no stupid questions here! Here you go.
 
  • Like
Reactions: C114

Dovidhalevi

Senior Member
Jun 26, 2012
2,729
1,171
Snackbar Tasker Plugin and AutoShare are completely optional for this profile. The XML I attached uses it because I have paid for it and already use it frequently, but if you follow the instructions I've written above then you do not need to use either.

I installed them, not yet paid up. However, if I can get along without them, I already have a pretty crowded phone so a couple less apps would not hurt.

As I said, the problem is hand-entering all this stuff. Please attach a "virgin" version as well. Folks could try them both, see if they prefer snackbar's eye-candy or going bare is good enough. Unless I intend very involved usage, AutoShare might be overkill.
 
Not sure what I am missing, but the Send Intent action never fires for me, as the IF statement never passes.
I added a Flash action to verify that the %bs_command variable is being set correctly, and it appears to be.
Any ideas?

EDIT: Scratch that.. looks like my phone autocorrected one of the commands in the Send Intent action. Working now!
 

Attachments

  • Screenshot_2016-03-09-09-54-55.png
    Screenshot_2016-03-09-09-54-55.png
    250.7 KB · Views: 288
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    Do you find yourself annoyed having to manually add someone as a contact after receiving a phone call from them? Would you rather be prompted with the option to add them as a contact before you fumble going through the proper menus? This short tasker task will do just that for you, using the power of intents.

    Prerequisites

    1. OPTIONAL: Snackbar Tasker Plugin to make a neat prompt asking you to add the previous caller as a contact

    Instructions

    1. Click + to create a new Profile and name it "Add Contact" or anything else you want.
    2. Choose a "State" context, go to "Phone" and select "Call." Set the Type to "Incoming" and leave the Number field blank.
    3. Back out, and name the task that pops up whatever it is you want.
    6ebqoKu.jpg


    Here's what your Profile should look like. Now, let's move on to the task itself.

    1. Task --> If. For the first condition, put %CNAME ~ %CNUM. This checks whether or not the previous caller already has a set name by comparing it to the phone number they called from. If the two match, then that means the contact is not recognized. Press the + icon to create another Condition, and make sure that the two Conditions are linked by an And. For the second Condition, set it to %CNUM !~ 0. This checks to see if the previous caller was an unknown/private number, and if so, you won't be prompted to add them as a contact.
    2. OPTIONAL: Plugin --> Snackbar Tasker Plugin. Select a "Bottom Sheet". Enter the configuration for the snackbar, and enter a title for the dialog that will pop-up (I put "Add caller as contact?"). Under "Items to appear in sheet separated by ","" put down Yes,No. Under "Commands to be sent separated by "," enter yes,no. Take note that there should be NO space between the comma. For the color name fields, enter the hex name for however you want the snackbar to be themed. When you're done, exit out by pressing the checkmark, then press the back key when you're back inside Tasker.
    3. System --> Send Intent. Under Action put in android.intent.action.INSERT For Cat, leave it at None. For the Mime Type, type in vnd.android.cursor.dir/raw_contact. Next, for the first Extra field type in phone:[%CNUM] Finally, scroll down to Target and select Activity. If you followed the optional step above to make a snackbar, then under If set the condition to %bs_command ~ yes. This means the intent will only be sent if you select yes when the snackbar pops up after a phone call.
    4. Task --> End If
    ez8AX0v.jpg


    That's it! Let me know if there are any suggestions you would make.
    2
    I notice that when I click "Yes" to add the caller as a contact, the phone number comes in the format [##########] with the brackets around it. Is there a way to make it come in the format +1 ###-###-#### ?


    The default intent action requires it to be formatted as such, as anything else simply makes the PHONE field end up as blank (not sure why). However, you can use AutoShare's intent builder with this intent in order to get around this. Credits to redditor /u/YoungKnave for this intent. You download this, import it into AutoShare, then inside Tasker rather than sending an intent through itself you would go to Plugin --> AutoShare and select the intent you imported. Then for the phone number, put %CNUM. I found that doing it this way properly formats it, however I didn't mention it above because AutoShare isn't a free app.
    1
    Very nice, except I will never get this typed-in. Maybe publish the script that can be downloaded and inserted from tasker.
    I added it as an attachment.
    1
    Found the profiles folder and moved it to there and was able to import it (one thing about tasker are all those non-intuitive, even hidden functions to try out, somehow :))

    Needs a Bottom Sheet and an AutoShare plugin. What do I install? A lot of plugins with paid additions by one author.

    Snackbar Tasker Plugin and AutoShare are completely optional for this profile. The XML I attached uses it because I have paid for it and already use it frequently, but if you follow the instructions I've written above then you do not need to use either.

    It might seem odd, but once you get into Tasker you will notice a recurring name in the most frequently recommended plugins: joaomgcd. This guy is a wizard at Tasker, and has made dozens of Tasker plugins. While you CAN do things without his plugins (as I've written) it does make things neater and simpler. It's up to you though.

    I tried this but I keep getting red marks on the if statement. Is there something I did wrong? Also, I couldnt download the file. How do I download it?
    Thanks

    The red marks are fine. They simply mean that RIGHT NOW if you were to run the task it would fail the If statement. Meaning, the last phone call you had was from a recognized phone number, hence Tasker would fail this condition since it should only fire when the previous caller is not a recognized contact.

    Ok, most stupid question ever. Where do i get the tasker from?

    There are no stupid questions here! Here you go.