FORUMS
Remove All Ads from XDA

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

833 posts
Thanks Meter: 1,866
 
Post Reply Email Thread
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.


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


That's it! Let me know if there are any suggestions you would make.
Attached Files
File Type: xml Add_Contact.prf.xml - [Click for QR Code] (15.2 KB, 3350 views)
The Following 12 Users Say Thank You to MishaalRahman For This Useful Post: [ View ] Gift MishaalRahman Ad-Free
 
 
7th March 2016, 07:14 PM |#2  
Senior Member
Thanks Meter: 1,186
 
More
Quote:
Originally Posted by MishaalRahman

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.


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


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.
7th March 2016, 10:49 PM |#3  
MishaalRahman's Avatar
OP Editor in Chief
Thanks Meter: 1,866
 
More
Quote:
Originally Posted by Dovidhalevi

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.
The Following User Says Thank You to MishaalRahman For This Useful Post: [ View ] Gift MishaalRahman Ad-Free
8th March 2016, 01:47 AM |#4  
Member
Thanks Meter: 14
 
More
Working great. Thank you.
8th March 2016, 03:10 AM |#5  
AKW's Avatar
Senior Member
Flag Jacksonville
Thanks Meter: 571
 
More
Good stuff man. I'll test tomorrow.
8th March 2016, 08:40 AM |#6  
Senior Member
Thanks Meter: 1,186
 
More
Quote:
Originally Posted by MishaalRahman

I added it as an attachment.

I had succeeded in doing this before. However, Tasker does not "see" this in either the projects or autimport folders. To where might I push it?
8th March 2016, 05:56 PM |#7  
MishaalRahman's Avatar
OP Editor in Chief
Thanks Meter: 1,866
 
More
Quote:
Originally Posted by Dovidhalevi

I had succeeded in doing this before. However, Tasker does not "see" this in either the projects or autimport folders. To where might I push it?

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.
8th March 2016, 06:01 PM |#8  
AKW's Avatar
Senior Member
Flag Jacksonville
Thanks Meter: 571
 
More
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 ###-###-#### ?
8th March 2016, 06:06 PM |#9  
MishaalRahman's Avatar
OP Editor in Chief
Thanks Meter: 1,866
 
More
Quote:
Originally Posted by Akw6190

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.
The Following 2 Users Say Thank You to MishaalRahman For This Useful Post: [ View ] Gift MishaalRahman Ad-Free
8th March 2016, 07:04 PM |#10  
AKW's Avatar
Senior Member
Flag Jacksonville
Thanks Meter: 571
 
More
Quote:
Originally Posted by MishaalRahman

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.
8th March 2016, 08:07 PM |#11  
Senior Member
Thanks Meter: 1,186
 
More
Quote:
Originally Posted by MishaalRahman

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.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes