In Part 1 of this recipe, we were able to write a phone number and the SMS content to a tag, but we didn't implement the logic to read it. In this recipe, we will complete the application and create a fully functional application ready for daily use.
Please have a look at the Sending a predefined SMS – Part 1 recipe in Chapter 4, Writing Tag Content – Real-life Examples first, as we need to use the result code files in this recipe.
In Part 2 of the recipe, we will read the URI in the tag and send an SMS. You can jump to step three if you have done Part 1 of the recipe and don't want to create a different project.
Open Eclipse and create a new Android application project named
NfcBookCh6Smsand a package named
Import the code and resources files from the Sending a predefined SMS – Part 1 recipe in Chapter 4, Writing Tag Content – Real-life Examples.
With the following code, request permissions to send an SMS: