Let's follow these steps to send an SMS using intents:
- Anko provides the sendSMS method, which takes in two parameters—one of them is the phone number, and the other is the message:
sendSMS("+9195XXXXXX","Hi")
- Calling this method will launch the messaging app, or will ask you which messaging app to launch if you have more than one type of that app and will prefill the message body. Calling this function requires you to add the following permission, without which it will throw a Security Exception:
<uses-permission android:name="android.permission.SEND_SMS"/>