From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Send an SMS message from an app

Send an SMS message from an app - Android Tutorial

From the course: Android Development Tips

Send an SMS message from an app

- [Instructor] You can send an SMS message programmatically from an Android app with a bit of Java code. But you have to first make sure that the appropriate permission has been granted. In Android 5 and earlier, that's just a matter of declaring the permission in the app manifest. But starting with Android 6, the user has to grant permission exclusively at runtime. The particular permission you need, named "SEND_SMS", is categorized in these more recent versions of Android as a dangerous permission. The user has to grant that permission at runtime using an asynchronous operation. So in this tip I'm going to describe how to set up the code to request and handle the permission and then how to send the SMS message. And to demonstrate this, I'll be using two different cell phones. The one on the left is a Google Pixel with a real phone number, and the one on the right is a Nexus 5X that's using Google Voice. So it has its own phone number and can receive text messages. In this…

Contents