SMS URL on Android

I was wanting to know if Android had a similar feature to the iPhone in that you can use an HTML A tag to send an SMS by setting the HREF attribute to the phone number you want to send the message to and prefixing it with "SMS:", i.e. href="SMS:02313213"

I've had a look around and can't seem to find anything that suggests it is available on Android.

1

9 Answers

I found the following which may help you:

You can check sub-section 2.5 or 2.6 of this RFC to give you some additional pointers on formulating a proper SMS URL.

Eg. using formal URI-spec as detailed in sub-section 2.2 of rfc5724:

<a href="sms:+19725551212?body=hello%20there">SMS Me</a> 

Notice the 'escaped' character for the 'space' in the example above.

Hopefully the Android browser will permit you to generate XHTML forms based on this syntax. I believe they will (if I have some time over the next day, I shall give it a try on my Galaxy S).

3

href="sms:+xxx" works on my stock HTC Desire Android 2.2 browser and the Sense SMS app, but sms:+xxx?body= doesn't - error: invalid recipient(s). I was only really interested in setting the body - anyone seen / solved this problem?

My test page is here:

3

That should work:

<a href="sms:+437722735932">contact</a> 

I have noticed if you use a qrc code with text for mms:<phone_number>?body=<your message here.> this seem to work and avoid the error: invalid recipient(s)

here is a test qrc

1

If multiple recipients needed, this works:

Android:

sms:+15558675309,+15558675301?body=Text%20Here%20end! 

iOS, macOS:

sms://open?addresses=+15558675309,+15558675301/&body=Text%20Here%20end! 
1

If you wants to allow in Android and IOS, Following trick worked for me in both devices.

Without adding number :

sms:?&body<Your message goes here> 

You could use a CSS trick to display one or the other: CSS media query to target only iOS devices

@supports (-webkit-touch-callout:none) { /* CSS specific to iOS devices */ .android { display:none } } @supports not (-webkit-touch-callout:none) { /* CSS for other than iOS devices */ .ios { display:none } } <a href="sms://+12345">SMS me</a> <a href="sms:+12345">SMS me</a> 

If you need a URL working for both Android and iOS you can do this trick:

sms:+123456789?&body=hello%20there 

For US toll free numbers I found that removing the country code (+1) made texts work. I don't have an iPhone, but I'm on a Mac and the OSX messages app had no trouble with the number sans country code:

<a href="sms:8005555555">contact</a>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like