How Google Detects and Warns about Premium SMS Messages

We may earn a commission for purchases made using our links.

Billions of text messages are sent each year. Though the service is incredibly dated by modern technological standards, the SMS has persisted as among the most popular methods of communication. Google is pushing hard to get carriers on board with a new standard known as Rich Communication Services (RCS), but with so many competing messaging interfaces it will take some time before the ubiquitous text message is put to rest.

Since there are so many users sending and receiving SMS messages each and every day, it’s a lucrative market for unscrupulous actors looking to make a quick buck. Premium SMS messages were for a long time abused to spam messages to unwitting users who are unaware that each message they receive is charged to their monthly bill. Thankfully, carriers banded together to do the right thing (for once) and refused to charge customers for reverse SMS scams. Today, though premium SMS services aren’t really used by most people, certain services like mobile ticketing provide users an easy way of paying certain bills via text message. On Android devices, whenever you send your first SMS to a recipient that charges for receiving messages, you’re met with a warning.

Google warns you before you send a premium SMS to certain recipients. Much like setting other default options, you’re able to set Android to remember your choice for future messages to that same recipient. In case you accidentally set a default you need to undo, you are able to control the text messenger app’s permission to handle Premium SMS messages by going to Settings –> Apps –> Permissions (hit the gear icon) –> Special Access –> Premium SMS Access. But how exactly does Android know when to warn you that you’re sending a message to a premium SMS service? We decided to look into this obviously very important question to find out.

Google’s SMS Blacklist

As it turns out, Google maintains a publicly-viewable database of SMS short codes that it blacklists. The list is sorted by country so it only checks for premium SMS services that are actually utilized in your country. For example, here is the list for the United Kingdom:

<!-- United Kingdom (Great Britain): 4-6 digits, common codes [5-8]xxxx, plus EU: http://www.short-codes.com/media/Co-regulatoryCodeofPracticeforcommonshortcodes170206.pdf, visual voicemail code for EE: 887 --> <shortcode country="gb" pattern="\d{4,6}" premium="[5-8]\d{4}" free="116\d{3}|2020|35890|61002|61202|887|83669|34664|40406" />

What’s listed under each country is a regular expression that is checked against before each text message is sent. If the number you are sending to matches one of the numbers in this regex, then you will be warned that the service you are sending a message to may charge you for the message. You’ll notice that under each country listed, though, not all of the premium SMS services may be listed. Instead, Googlers are constantly updating this database based on the most up-to-date reference information they can find for each country. As evidence for this, the last update to this database was made on October 14th, 2016. Though the list is not comprehensive, it’s still nice that Google maintains a list to ensure that you really meant to send that one premium text message.

That’s all for today. We hope you’ve learned something new, and if you have anything you want us to look into, feel free to reach out to the Portal team on the e-mail addresses listed on our profile pages!