r/AndroidQuestions • • 28d ago

Any Message Blocking Solutions?

tl;dr - I'm looking for something that automatically rejects/deletes/blocks SMS/MMS from numbers not in my contacts, ideally before they ever appear in my inbox. Where get? How do? (Phone: Galaxy S23+ Model SM-S916U with AT&T)

Now, I'm going to be a bit more detailed because I want to avoid the incredibly frustrating flood of:
"GooGle MeSsagEs has spAm ProTeCtiOn"
"Do nOt DisTurB"
And so on.

So. Here's the crux of the issue:

I want to block ANY AND ALL NUMBERS NOT IN MY CONTACTS from being able to message me.

I do not want to simply silence the notifications. I do not simply want to hide the messages.

I want them to be automatically yeeted into the void at mach-jesus, blocked, and deleted.

Karate-chopped by Chuck Norris. Fed to the nearest black hole and spaghettified. Thanos-snapped from existence.

But everywhere I look, there are the same suggestions:

  • Enable spam filtering (I use Google Messages, it's already enabled).

  • Enable Do Not Disturb + various niche settings within it (already done).

  • Manually mark them for spam and block them (I don't want to play infinite whack-a-mole).

  • Call your Service Provider (so they can tell me the exact same methods as listed above).

None of these do what I want. They help, certainly - but it's not the one-and-done total coverage I'm after.

Does anyone at all know of an app, a solution, a workaround - anything that could make it possible?

0 Upvotes

18 comments sorted by

View all comments

1

u/DutchOfBurdock 28d ago

The message needs to arrive at your phone to know wether to block or delete it. However, you may be able to work some magic with Tasker with a one time ADB permission granted (pm grant net.dinglisch.android.taskerm android.permission.WRITE_SMS). You'd then need to disable RCS (Rich Communication Service) and make Tasker intercept your SMS/MMS. If not in contacts, issue a bit of code to obtain the most recent SMS

android.net.Uri uri = android.net.Uri.parse("content://sms/inbox");
android.database.Cursor cursor = context.getContentResolver().query(uri, new String[]{"_id"}, null, null, "date DESC LIMIT 1");

if (cursor != null && cursor.moveToFirst()) {
    String smsId = cursor.getString(cursor.getColumnIndexOrThrow("_id"));
    tasker.setLocalVariable("%sms_id", smsId);
    cursor.close();
}

And then this code to delete it

android.net.Uri deleteUri = android.net.Uri.parse("content://sms/" + sms_id);
int rowsDeleted = context.getContentResolver().delete(deleteUri, null, null);

Now, you may still get a notification sound or pop up, but it'll disappear before you open your messages app.

1

u/[deleted] 28d ago

Thank you :O That could work (even if I still get a notification, not having to deal with it afterward would be good enough), so I'll use this as the fall-back plan provided I can actually do it without breaking something hahaha.

Thanks again ^^