How to send SMS (text) messages
Since you're probably already familiar with SMS (or text) messages, we won't spend time explaining what they are or why they are important. (If you're not familiar with SMS or want more information, see the link provided in the See also section of this recipe.) This recipe will demonstrate how to send an SMS Message. (The next recipe will demonstrate how to receive notifications of new messages and how to read existing messages.)
Getting ready
Create a new project in Android Studio and call it SendSMS
. Use the default Phone & Tablet option and select Empty Activity when prompted for Activity Type.
How to do it...
First, we'll add the necessary permissions for sending an SMS. Then, we'll create a layout with a Phone Number and Message fields and a Send button. When the Send button is clicked on, we'll create and send the SMS. Here are the steps:
Open the Android Manifest and add the following permission:
<uses-permission android:name="android.permission.SEND_SMS...