![]() (See the Appendix for instructions on copying a project.)Īdd an icon for the messaging button by following these steps: Copy the PhoneCallDial project folder, rename it to PhoneMessaging, and refactor it to populate the new name throughout the app project.After sending the message, the user can navigate back to your app using the Back button. In the messaging app launched by the intent, the user can tap to send the message, or change the message or the phone number before sending the message. The user can tap the messaging icon in your app to send the message. The new app launches a messaging app with an implicit intent, and passes a fixed phone number and a message entered by the user. In this task you create an app called PhoneMessaging, a new version of the PhoneCallDial app from a previous lesson. You will copy the app, rename it to SmsMessaging, and modify the layout to include another EditText for entering the message, and change the ImageButton to an icon that the user can tap to send the message. It checks for permission and then uses the SmsManager class to send the message.Īs shown in the figure below, the PhoneCallingSample app already has an EditText view for entering the phone number and an ImageButton for making a phone call. SMS Messaging: Change the PhoneCallingSample app from the previous chapter to enable a user to enter a phone number, enter an SMS message, and send the message from within the app. You will copy the app, rename it to PhoneMessaging, and modify the layout to include an EditText for entering the message, and another ImageButton with an icon that the user can tap to send the message. ![]() It uses an implicit intent using ACTION_SENDTO and the phone number to launch a messaging app to send the message.Īs shown in the figure below, the PhoneCallDial app already has TextEdit views for the contact name and the hard-coded phone number, and an ImageButton for making a phone call. #Send sms without number display codePhoneMessaging: Rename and refactor the PhoneCallDial app from the previous chapter, and add code to enable a user to not only dial a hard-coded phone number but also send an SMS message to the phone number. You will create two new apps based on apps you created previously for the lesson about making phone calls:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |