Android Enthusiasts Asked by Jon on January 24, 2021
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.
automation 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)
Trigger:
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
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
Action:
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)
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
Correct answer by beeshyams on January 24, 2021
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.
Answered by runrin on January 24, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP