iPhone handles street address in SMS message differently than Android

My web site has a “Send Directions to My Phone” button. It takes the street address and emails it to the SMS gateway of the person’s carrier (which they pick from a list). On Android, when the text message is received, the street address is recognized, underlined, and when pressed it asks with which program the user wants to display the address.

On the iPhone, the text message is received, but is not automatically converted to a link. Our users have said they don’t know how to copy the text to their map app.

Is there a way to force iPhone to make the address into a link?

I don’t know if this presentation will help you at all. It talks about the different ways of formatting links to launch different applications (one of them being the maps application)

http://www.docstoc.com/docs/3595962/iPhone-URL-Scheme

Also, this question in stackOverflow may be of help

http://stackoverflow.com/questions/6276402/how-to-convert-a-string-into-a-hyperlink-in-the-iphone-sdk

Thank you molona. The first link you sent was exactly what I was looking for but could not find. Unfortunately when I formatted my text as specified in the document and sent it to SMS, the SMS reader on the iPhone still didn’t make it clickable. Are any text messages on the iPhone ever clickable? Does that even happen?

The second link seems to be describing the method I would use if I were writing my own SMS reader for iPhone, and I wanted it to parse links automatically.

So, I am still looking for a solution. I would like to somehow send the address to an iPhone and have it be a clickable link to maps.

My friend showed me on his iPhone that if you go to Google Maps and choose “Share Location” and choose “MMS” then it will send an “MMS” message with a Contact file attached as a .vcf. I’m wondering if “MMS” is the same as “SMS”; if attaching a .vcf file to the email I’m sending to the provider will be attached to the text message; and if doing this will break Android, forcing me to ask the user what kind of phone they have. I’ll be looking into these questions and if anyone knows already I’d love to hear about it.

I’ve gotten this to work. I had to UrlEncode the street address in my C# code.


[FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]string [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]messageBody = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].Format([/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"{0} "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] + [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"http://maps.google.com/maps?q="[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] + [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"{1}"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], LocationName, Server.UrlEncode(longAddress));
[/SIZE][/FONT][/SIZE][/FONT]

Notice there’s no HTML anchor tags or anything. The text application was able to recognize the URL, though.

This worked! Thanks!

Just on a quick unrelated note. The biggest reason for string.Format() method is so that you do not need to contact strings. So you can replace:

string.Format("{0} " + “http://maps.google.com/maps?q=” + “{1}”, LocationName, Server.UrlEncode(longAddress));

with

string.Format(“{0} http://maps.google.com/maps?q={1}”, LocationName, Server.UrlEncode(longAddress));

And that is the same thing, but easier to read