Presentation is loading. Please wait.

Presentation is loading. Please wait.

Add to the Coffee Ordering App

Similar presentations


Presentation on theme: "Add to the Coffee Ordering App"— Presentation transcript:

1 Add email to the Coffee Ordering App
Android Topics Add to the Coffee Ordering App

2 Objectives In this in-class coding app, you will use an intent to send an order summary to an app. You should already have taken some time to experiment with writing code for different intents listed in the Common Intents guide. TIP: If you have no idea how to accomplish this: Research the common intents guide from the official Android Documentation. This site is very helpful for showing you how to send an intent to compose an with optional attachments. Do a web search. Look at Stack Overflow posts and tutorials.

3 Create a new intent object and pass the Intent.ACTION_SENDTO argument.
Set the data to be a URI of this format, "mailto:", that way all the apps will handle this intent. Add some extra data into the intent. Specify the subject of the message. Add the person’s name. Add the necessary intent extras for each additional piece of information you want to provide about the . For example, intent extra about the recipients of the Intent.EXTRA about the subject line of the . Intent.EXTRA to specify the body of the . Intent.EXTRA_TEXT is a constant defined in the intent java class as a string in the intent class. Populate this extra, containing the body of the message. When the app receives the intent, it will know to check for this intent extra to find the body of and then it can populate that. The body of the is the order summary. Check if there's an activity on the device to handle this intent. If there is then it's safe to send the intent and recall start activity using this intent. If there's no activity on the device to handle the intent, then we skip this block of code and we skip sending the intent. Run the app on our device. Now when I click on the order button, it sends an intent to an app on the device. By default, the Gmail app is going to handle this intent. Tasks


Download ppt "Add to the Coffee Ordering App"

Similar presentations


Ads by Google