Android - launch google map via web url

后端 未结 4 486
暖寄归人
暖寄归人 2020-12-04 14:35

On the iPhone, a maps.google.com URL is intercepted and loaded by the native google maps application. I would like do the same on Android, but Google Maps is being loaded in

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 15:20

    At this moment I use a javascript function that change the following templates:

    'urlTemplates': {
                "default": "http://maps.google.com?q={streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
                "ios": "maps:?saddr=Current Location&daddr={streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
                "android": "geo:{streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
                "windows_phone7": "maps:{streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
                "windows_phone8": "bingmaps:?where={streetAddress} {addressLocality} {addressRegion} {postalCode} {addressCountry}",
                "blackberry": "javascript:blackberry.launch.newMap({'address':{'address1':'{streetAddress}','city':'{addressLocality}','country':'{addressCountry}','stateProvince':'{addressRegion}','zipPostal':'{postalCode}'}});"
    

    with what informations I got depending on the device, I do not remember from where I got all the templates and I am sorry for that, and after that I open the the address using window.location.href.

    Hope this will help you. Because at the time I need this I spent a lot of time researching it.

提交回复
热议问题