
To access this metadata, SMS apps almost always use PDUs to encode the contents of a SMS message. PDU (protocol data unit) contains not only the SMS message, but also metadata about the SMS message, such as text encoding, the sender, SMS service center address, and much more. Most smartphones and mobile phones support what is known as "PDU mode" for sending and receiving SMS. Your app receives SMS messages by listening for the SMS_RECEIVED_ACTION broadcast. The Android framework sends out system broadcasts of events such as receiving an SMS message, containing intents that are meant to be received using a BroadcastReceiver. To receive SMS messages, the best practice is to use the onReceive() method of the BroadcastReceiver class. You can manage SMS operations such as dividing a message into fragments, sending a multipart message, get carrier-dependent configuration values, and so on.The user stays in your app during and after sending the message.Your code must ask the user for permission before sending the message if the user hasn't already granted permission.This is a good choice for sending messages from your app without having to use another installed app.Send the SMS message using the sendTextMessage() method or other methods of the SmsManager class.The user navigates back to your app using the Back button.The user can change the message in the messaging app before sending it.(Android smartphones will have at least one, such as Messenger.) If the user has multiple SMS messaging apps installed on the Android phone, the App chooser will appear with a list of these apps, and the user can choose which one to use.Your app doesn't need code to request permission from the user.The user can add a picture or other attachment in the messaging app, if the messaging app supports adding attachments. This is the simplest choice for sending messages.Use an implicit Intent to launch a messaging app such as Messenger, with the ACTION_SENDTO action.You have two choices for sending SMS messages: The Messenger app itself is governed by user permission. However, your app doesn't need permission to pass a phone number to an installed SMS app, such as Messenger, for sending the message.

Just as your app needs the user's permission to use phone features, so also does an app need the user's permission to directly use SMS features. SMS is neither encrypted nor strongly authenticated on either the network or the device.Īccess to the SMS features of an Android device is protected by user permissions. You should not use SMS to send data messages from a web server to your app on a user device. Note: The SMS protocol was primarily designed for user-to-user communication and is not well-suited for apps that want to transfer data.
