Menu

1 / 5

android_sms: build a real default SMS app on Android with Flutter

DEV Community: mobile·Abdeldjalil Chougui·4 days ago
#rpZlYS29
#devtomobile#devto#dev#message#default
Reading 0:00
15s threshold

Most Flutter SMS plugins let you send a message and listen for incoming ones. That is enough for an OTP screen, but not for a messaging app. On Android, only one app at a time is the default SMS app , and that app has jobs nobody else can do: it is the only one that receives the SMS_DELIVER broadcast, and if it does not write an incoming message to the system Inbox, the message is simply not stored anywhere.

android_sms is a Flutter plugin built around that rule. It covers the whole path through the official default-SMS-app role: asking the user for the role, sending with status reports, storing incoming messages, reading conversations, and handling messages that arrive while your app is closed.

What it does

The role. isDefaultSmsApp() tells you whether your app holds the role, and requestDefaultSmsApp() opens Android's own dialog. It uses RoleManager on Android 10 and later, and the older ACTION_CHANGE_DEFAULT intent below that.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.