I need a way to block all calls from an area code, unless the number is in my contact list. Anyone know of a way to do that?

I found plenty of apps that can block by area code, but they'll also block any of my contacts if they have that area code. I could add each of my contacts to a whitelist, but then I have to remember to do that each time I add a contact.

  • 2
    This is not a function Android is capable of in itself... You might be able to find a third party contacts or dialer app that has this capability though I don't know of one with this kind of granularity.
    – acejavelin
    Commented Mar 30, 2017 at 16:06
  • I need to figure out how to work with mobile numbers, but I think it'll work. Thanks!
    – Jon
    Commented Apr 1, 2017 at 16:11
  • Good. Thanks for accepting. Fortunately Macrodroid does have this capability without getting into reading contact list etc. For mobile numbers, you may need to consider the numbering scheme as it differs from carrier to carrier (at least in my country). You can add all these in the same macro, since triggers work in logical OR . All the best : )
    – beeshyams
    Commented Apr 1, 2017 at 16:14
  • Interesting - I'm not familiar with number schemes varying with carrier. Do you know of any references I can look into to get a feel for that?
    – Jon
    Commented Apr 1, 2017 at 18:07
  • For India. You may need to search for your country
    – beeshyams
    Commented Apr 1, 2017 at 18:15

2 Answers 2


is the preferred option. Many apps are available. I prefer using MacroDroid , since it is free (upto 5 macros) and easy to learn.

You would need two macros for this

First macro would be to set a flag when the call is from an area code

Macro : Area code (name of macro as example)


  1. Call incoming → Select number → abc* ( where abc is numeric area code you are interested in and * is wildcard to represent any number . You need to know / experiment here - in my case I needed to type +<2digit country code><2 digit state code>< * wild card > to test with land line telephone

  2. You would need another similar trigger for identifying mobile numbers from that area if / as applicable

Action: Set Macrodroid Variable → New variable → from area code ( name of flag, it can be anything ) of type Boolean to true

Constraints: Leave blank

In the next macro we reject the call when the twin conditions of calling number is a non contact and from that area code are met

Macro : Reject call (name of macro as example)

Trigger: Call incoming → Select Contact → Non contact


  1. Call reject

    add constraint to this action by long pressing action

Macrodroid Variable →from area code = True (Macro only runs in this case, satisfying twin criteria conditions)

  1. Set Macrodroid Variable → from area code to false ( initialisation of flag )

Constraints: leave blank

I have only tested with landline available to me and it worked. Logic has been explained and you would need to configure with special attention to area codes of landline / mobile

  • The wild cards don't seem to be working for me. If I enter an exact 10-digit phone number in the trigger, macro droid picks it up just fine. But if I use ? like you showed for the last 7 digits, the trigger misses the call. Any ideas why that might be?
    – Jon
    Commented Apr 2, 2017 at 21:23
  • Let's isolate the problem. First, disable macros already created ( slide toggle on top). Second, create a simple macro. Trigger: as confused by you which isn't working ; Action: call reject; constraints: blank. Save and test. If it didn't work to reasons- a) area code or number of wildcards used is wrong b) macro isn't getting activated at all- from top left of main menu of app go to system log and see if the macro is being called and time. If you don't find the macro referred there, it isn't being called at all and confirms wrong entry of area code or wildcards
    – beeshyams
    Commented Apr 3, 2017 at 3:02
  • Typo - for "Trigger: as confused by you " read "Trigger: as created by you " - auto correct will kill me one day
    – beeshyams
    Commented Apr 3, 2017 at 3:13
  • The process that you described is almost exactly what I did. The only macro in there right now is to pop up a message when I get a call from an exact 10-digit number. The message pops up as expected here. But when I replace the last 7 digits of the number with "???????" or "?" or "*******" or "*" (all without quotes), the message doesn't pop up. If I put the exact 10-digit number back in, then the message pops up again as expected.
    – Jon
    Commented Apr 3, 2017 at 16:42
  • 1
    Yeah, I'm not sure what's going on. I may come back to this later, but it's proving more of a struggle then it's worth to me for now. I appreciate your help with it.
    – Jon
    Commented Apr 3, 2017 at 18:55

beeshyams' solution did not work for me, but i was able to modify it and get it working. The issue that i encountered was that the "call incoming" trigger only happens once when you first receive the call. this means if you check for a boolean triggered by the incoming call, it won't be set yet.

first thing i did was find out what format i needed for the phone number by creating a very simple macro:

trigger: call incoming -> contacts -> any number
action: logging -> log event -> call number

i checked the logs and saw that the number was +12345678900. (im in the us)

next i deleted that macro and made the following:

T: call incoming (+1234*)
A: set variable (areacode: True)

T: call incoming (non contact)
A: set variable (noncon: True)

we are going to use the variables being set as our trigger to reject the call. these variables seemed to be set in a random/inconsistent order, so i just made two triggers, that way it didn't matter which was set first. this is a very janky solution, but it works.

T: macrodroid variable change (areacode = True)
A: call reject, set variable (areacode: False), set variable (noncon: False)
C: macrodroid variable (noncon = True)

T: macrodroid variable change (noncon = True)
A: call reject, set variable (areacode: False), set variable (noncon: False)
C: macrodroid variable (areacode = True)

finally, we need a way to reset the variables if our call blocking macros haven't been triggered. the best solution i found was to clear them after a call was completed or missed.

T: call missed (any number), call ended (any number),
A: call set variable (areacode: False), set variable (noncon: False)

i'm sure there is probably a more elegant solution, but this is at least working for me. (hooray, no more scam calls at 6am!) luckily there are exactly 5 free macros in the app, and 5 in my solution. if you have multiple area codes you need to block, you can put them all into the one macro with a separate trigger for each i think. (didn't test this)

all of this pain could be solved if you could have a trigger be caused by two conditions being met. that would mean we would only need a single macro, but from what i can tell, this isn't possible. unfortunately the constraints don't let you access the incoming call information so that doesn't work either. maybe there is a better app.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .