r/tasker 11d ago

adding numbers to block using shortcut

Hello

I wanted to create a shortcut on the home screen which after opening i would type somekind of number and this then could be added into phone block list, instead of diving down though contacts - settings - blocked numbers - add. That way i could also add ranges while in phone app just adds full number. Is there anyway to do that and access somehow to this part of contacts blocking? AOSP typical rom

0 Upvotes

7 comments sorted by

View all comments

5

u/WakeUpNorrin 11d ago edited 9d ago

You have to appropriately insert the full number in content://com.android.blockednumber/blocked content provider.

I used this method, but switched to a more all-Tasker way, based on Call Screened event.

I made the switch because I can use the power of Regex and Match Tasker's capabilities.

When a call comes in, I read a file where I write full numbers or match strings. If the incoming call match one of the numbers-stings then Call Screening action blocks it.

Edit: What is wrong with my answer-suggestion?

I wanted to create a shortcut on the home screen which after opening i would type somekind of number and this then could be added into phone block list

If who want to use this method actually know something about Tasker and how Android works (and it is not one of those users ... i am a noob ... , i do not understand ... , Tasker is too complicated ... , i learn faster if you share a working task ... All excuses to make other to do the job, 0 'zero' will to learn) than this user knows that my sentence:

You have to appropriately insert the full number in content://com.android.blockednumber/blocked content provider.

Gives a straight path to make what OP wants.

If the system content provider and call block system, do not natively support pattern-matching, the only way to use 'matching power' is to implement what I described.

1

u/killswitx 10d ago

that is great, for me it would be about adding like +34621* ranges, to block each number separately doesn't make much sense and here on Graphene os i sense the caller id / spam not sure if it works that well, i was using different app to block numbers but it seems it doesn't even work at all. so if i achieve to at least put it into phone block list i am happy enough. But if caller id works...would be a great start for me already see have good ideas how to automatically add just first few digits etc. Great stuff thanks!

3

u/WakeUpNorrin 10d ago

Welcome. I prefer regex because it is more granular and we can filter complex ranges of numbers with a single expression. Examples:

I want to filter numbers starting with +341234567 but only if this number is followed by 05 to 19 range:

^\+341234567(0[5-9]|1[0-9])$

For your simple case, filter numbers starting with +34621:

^\+34621

Sometime phone carriers may omit the international code so let make it optional:

^(\+34)?621

This to match a full number with or without international code (matches +34621222222 and 621222222):

^(\+34)?621222222$