Search code examples
androidiosgeolocationdeep-linkingwhatsapp

Linking geolocation on WhatsApp text messages


I was looking for a way to send geolocation (latitude and longitude) as an hypertext, or kind of, through messages in WhatsApp.

I've tried sending a text message like "geo:37.786971,-122.399677", which works inside href on mobile Chrome, but it won't work as a text message on WhatsApp. It "understands" those numbers as phone numbers...

My point is, is there anyway to text latitude and longitude to a contact in WhatsApp, in a way the other person can click and open that geolocation with their preferred App? I could create a custom Google Maps link, but that wouldn't allow the receiver to easily use Waze for that geolocation, for example.

Even if it would work only for Android, it would be helpful.


Solution

  • iOS uses data detectors to offer actions with certain types of data: when the OS recognizes, say, a phone number or a URL in text, it highlights it automatically and offers available actions (like making a call or opening a website). Location coordinates aren’t among default data detectors (plus, even default detectors can be disabled). It’s up to app developers to implement custom detectors. So unless WhatsApp adds native support for location pointers, I’m afraid you’ve got no way to have location pointers highlighted the way URLs are.

    Probably the most convenient solution in that situation (it’s not ideal, though) would be to set up a web service that will accept location coordinates and present a list of apps that support this kind of data. This way, you’ll be able to share links, like mylocation.is/37.786971,-122.399677 (I just made up the URL), and tapping on such a link will open a page with a list of apps that can accept coordinates (keep in mind that you won’t be able to limit the list to apps installed on the device).