The SMSManager class controls actions such as sending text, data, and multimedia messages (MMS). SendTextMessage() is used to send text messages, while sendMultimediaMessage() is used to send multimedia messages, and sendDataMessage() is used to send data messages.
Android phones can send and receive text messages to and from any other phone that supports SMS (SMS). When it comes to sending SMS messages, you have two options:
With the ACTION_SENDTO intent action, use an implicit Intent to launch a messaging app.
This is the most straightforward method of sending messages. If the messaging software enables attachments, the user can add a photo or other file to the message.
- To ask the user for permission, your app doesn't need any code.
- If the user has numerous SMS messaging apps installed on their Android phone, the App Chooser will show a selection of these apps, from which the user can select one. (At least one, such as Messenger, will be available on Android handsets.)
- Before sending the message, the user can edit it in the messaging app.
- The user uses the Back button to return to your app.
Use the sendTextMessage() method or other SmsManager class methods to send the SMS message.
- This is an excellent option if you want to send messages from your app without needing to use another app that you have loaded.
- If the user hasn't already given permission, your app must seek permission before sending the SMS message.
- During and after sending the message, the user remains in your app.
- You may do SMS actions such as fragmenting a message, sending a multipart message, and retrieving carrier-specific configuration settings, among others.