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 explicitly from within the app. The permission, named SEND_SMS, is categorized as a “dangerous” permission.
- [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 application's beginning state,…I have the ability simply to display messages…
Skill Level Intermediate
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.
Android App Development: Communicating with the Userwith Joe Marini1h 12m Intermediate
Building Android Apps with Cloud Serviceswith Albert Lo2h 37m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
New This Week:
1. Android Development Tips Weekly
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.