1

I'm developing an Android App that can send the user's current location via SMS.

For sending the SMS I use the following code:

String phoneNumber = "123456" //example
            SmsManager smsManager = SmsManager.getDefault();
            StringBuilder smsBody = new StringBuilder();
            smsBody.append("This is my location:\n");
String uri = "http://maps.google.com/?q=loc:" + location.getLatitude()
                + "+" + location.getLongitude();
            smsBody.append(uri);
            smsManager.sendTextMessage(phoneNumber, null, smsBody.toString(),
                    null, null);

Now, when I send this to an Android device, I get a SMS with the link, and it opens perfectly in the native browser and in Google Chrome.

But, if I send it to an iPhone device - using the native browser (Safari) - it gives me an error that it cannot open the address because it is incorrect, but if I open it using Chrome (also on iPhone) - It works perfectly.

Has anyone got a clue why this is happening? Any workaround?

Here is an exact copy of the SMS message that is received:

This is my location: http://maps.google.com/?q=loc:32.05688742112759+34.899831548802496

Many thanks in advance!

EDIT:

Here is a screen capture of the error I'm getting when I try to open the link on an iPhone 4 running iOS7 enter image description here

gilonm
  • 1,829
  • 1
  • 12
  • 22

2 Answers2

0

IOS don't support SMS location by link

Yossi Gruner
  • 120
  • 7
0

It is because iOS support its native map. Your query url only works with google map. You can try this url for iOS: "http://maps.apple.com/?q=loc:32.05688742112759+34.899831548802496"

Sats
  • 875
  • 6
  • 12
  • Well, Seeing it opens in a browser, it should support it, and apparently iPhone 5 does support it (see answer below). Do you have any source or link to support your answer? Thanks! – gilonm Sep 25 '14 at 07:52
  • you can check here: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html – Sats Sep 25 '14 at 08:08
  • Well, it said there that you CAN use that link form, not a MUST. But, based on your answer, I also found this answer [here](http://stackoverflow.com/questions/18223533/how-to-launch-google-maps-on-iphone-via-web-link). When I used the link the way you said it DID work both on Android and iOS. Thanks for you help solving my problem! – gilonm Sep 25 '14 at 08:29