2

So I am building and HTML 5 app to run on mobile devices and I have addresses. I am wondering if it is possible to code them somehow to make iOS and Android recognize them as such and launch the native mapping app.

An example that I know works is phone numbers...I can code a link with "tel:" and a mobile phone will dial the number.

Is there something like this for addresses and maps?

Thanks!

David

David
  • 2,173
  • 3
  • 25
  • 36

2 Answers2

0

Unfortunately there is no easy tag you can use across platforms but I did find a few suggestions for iOS under this topic: Link to iPhone map App from HTML page

Perhaps there is something similar for Google Maps on Android?

Community
  • 1
  • 1
IanStallings
  • 806
  • 10
  • 21
0

In android you can control WebView's behaviour when the user click on a link by setting a custom WebViewClient and override the shouldOverrideUrlLoading method. In the example, if a user click on a link that ends with "toast" a toast will be showed. Of course you can do more fancy checks with regex and do something more sofisticated. I don't know how to achieve this on ios but I hope it can help.

myWebView.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (url.endsWith("toast")) {
            Toast.makeText(MainActivity.this, "wow", Toast.LENGTH_LONG).show();
            return true;
        }
        return false;
    }
});

EDIT
It looks like it can be done on ios too, try to check this example.

lelloman
  • 13,883
  • 5
  • 63
  • 85
  • Is this just for native apps, or can it work in the default browser? My app is a web app, not native... – David Sep 16 '13 at 20:12
  • @David yes, I thought your app was html in a webview, for a mobile site I have no idea sorry :) – lelloman Sep 17 '13 at 09:17