Air for Android: Text Messages, Emails, and Phone Calls
Why do you build mobile apps on a phone? Well obviously to make phone calls, send text messages, and email your buddies random links to sites that should have their content prefixed with NSFW. You may worry that this is difficult to send the information around the Android system. If so, then you obviously don’t have faith in Adobe and how easy they can make something. Have you not seen the content assist videos?
Anyways.
Here is the long and the short to making phone calls, sending emails, and texting from your application.
If you are starting with this post I recommend actually starting with a previous post introducing AIR for Android Development. There is a ANT file there that you will want to have.
Website
Have you ever navigated to a website? Yup, navigateToURL…
Phone Call
Adobe has made it so easy that the same idea holds true to phone calls…
Text Message
And text message…
Email
And wouldn’t you know… email…
Additional Information
You can add additional information like email subject, text message body and whatnot right in the link. Feel free to play with it and integrate your application.






That is so sick! I would not have imagined it being that simple. Very cool Adobe, very cool!
[...] Air for Android: Text Messages, Emails, and Phone Calls Hogyan küldjünk Androidon futó Flash-b?l E-mailt, SMS-t és hogyan indítsunk hívást. [...]
I believe you can even do this using basic HTML/Javascript web apps. Doesn’t this method simply delegate the phonecall/sms/email to the OS’s default handler for each? By the title, I was kinda hoping to read about email/SMS/phonecalls from within your own app. Still cool though.
sms:555555555?body=Hello and android put the entire text in the send field and does not populate the body text, anyone know why?
@ixustruestories I’ve tried it a few different ways and each time I get an “invalid recipient” error. If you figure out the trick I’d be interested to find out.
thanks for posting these, ofc bookmarked!
Look at this page which actually references you Jonathan.
http://www.adobe.com/newsletters/edge/november2010/articles/article1/index.html
This following snippet of the article is taken from their under the section “Triggering built-in phone features”
In my application, I take advantage of the Android phone’s ability to send e-mail to enable users to share their gamer entries or profile name easily. Triggering e-mail is incredibly simple and can be done with as little as one line of code using the navigateToURL() method. Below is the code from the GamerProfile view that triggers the e-mail application with the provided subject and body details:
protected function emailEntry():void {
var subject:String = “Check out my XBox Live Profile”;
var body:String = model.info.gamertag + ” from ” + model.profile.getFullLocation()
+ ” wants to be your friend on XBox Live.”;
navigateToURL(new URLRequest(“mailto:?subject=” + subject + “&body=” + body));
}
@Chris very cool!
is there a method to attach a file to the e-mail with mailto. I am trying to attach an image but i could not figure out.
@Tekin There isn’t a way that I’ve heard how to do this with the mailto link. You could easily have the user attach an image or upload an image and provide the link, but not add an attachment.
The phone overall was very nice. Didn’t weight much and the touch screen was responsive. The Android OS ran well. I liked it overall. It being unlocked and cheap along with the Android OS made it a good buy I thought at the time. The problem I had was that while the features were nice I could not get the phone to update via the official tools. Others had this problem all over the world with this particular phone. Some had to wait for their cell providers to push out the update but those that bought it unlocked from various places had issues at the time. The choice I was left with at the time was to install the update myself. A process if done wrong could turn the phone into a paperweight. With no US warranty I didn’t feel safe in doing so. So in the end I returned it and thankfully because the device was fulfilled by Amazon.com I was able to get my money back. If I had the chance to buy the phone again but with the update already installed I would as I am a fan of the Android OS and did like the phone overall. However I would warn people that if they do want to update and don’t feel like taking certain risk to perhaps look for a different phone or one with a US warranty.
Problem with mailto.
urlString =”mailto:”+sendTo+”?subject=”+emailSubject+”&body=Generated call report\n \n”+messagePart1+”\n \n”+messagePart2;
what is sent to the compose screen is the email address, subject, but in the body only
“Generated call report” . The same string is displayed elsewhere with no problem.
This is only happening with one downloaded app to a droid incredible. All others, including other incredibles, work fine. Could this be a setting on that phone? I even tried changing the line breaks to \r\n but no luck.
Any thoughts?
@Jason The big issue with Android development is all the little 2bit hackers builting custom mods but don’t really do the proper testing on their mod. I go into that rant to ask if the one failing incredible has something custom to it?
[...] Air for Android: Text Messages, Emails, and Phone Calls by Jon Campos - http://www.unitedmindset.com/jonbcampos/2010/09/28/air-for-android-text-messages-emails-and-phone-ca… [...]
how to attach file in email need help
@Rishi currently this feature isn’t supported. you could do it with a native extension.
How to attach an mp3 file in SMS. I know it’s possible by using native send sms application, but how to call that native application with the file already attached? Thank you!
@andrei by default you cant. You’ll need to use a native extension. I believe I saw one out there on the Adobe extensions page. Could be wrong though. I know you’d need a native extension for that functionality.
I forgot to mention that I’m working on a flex mobile project for android OS. Maybe there is a parameter to be set when calling “new URLRequest(“sms:” phone-number)”. I’ve seen some blog posts where the URLRequest passes, beside the phone number, a text representing sms body. thank you!
Can you send html emails?
@cesare honestly I haven’t tried but I don’t see why not.
Anyone know of a good way to detect if “tel:” is supported by the device (so if the device can make calls or not)? I found the method below but it’s not foolproof of course.
/**
* Calculates the screen diagonal of the device and returns true if the
* screen diagonal is greater than 6 inches, which most devices without
* phone capabilities are.
*
* @return Boolean indicating whether this application is running on a
* tablet (without phone capabilities).
*/
public static function get isTablet():Boolean
{
var screenDiagonal:Number = Math.sqrt( Math.pow(
Capabilities.screenResolutionX / Capabilities.screenDPI, 2 ) +
Math.pow( Capabilities.screenResolutionY / Capabilities.screenDPI, 2 ));
return ( screenDiagonal > 6 );
}
@Thijs you could create an ANE that reads the phonestate prior to use. But I agree other than that there isn’t much of a way to check.