2017-05-29 8 views
0

私は、Googleマップv3 APIを使用して統合された地図を持つアプリを持っています。マップでは、クライアントの名前、住所、ルートを確立するためのリンクが表示されたマーカーが表示されます。地図上のリンクは動作しません

リンクをクリックすると、Googleマップのネイティブアプリケーションに移動する必要がありますが、応答はありません。ガソリンスタンド、ビジネスなどのGoogleのマーカーの他のリンクでも同じことが起こります。

地図、ブックマーク、情報ウィンドウ、およびネイティブアプリケーションを開くべきものを読み込むメソッドを添付します。グーグルマップ。

< - 編集---> コアアプリケーションは、html、css、javascript、およびjqueryです。それはアンドロイドやアイオスネイティブdoesn't。

機能initMap()アンドロイドの場合は、{

// Origin, could be latlng or ZipCode 
    var pointOrigin = new google.maps.LatLng(itemsPosition[0].latitud, itemsPosition[0].longitud); 

    var map = new google.maps.Map(document.getElementById('map'), { 
     zoom: 15, 
     // Map 
     center: pointOrigin 
    }); 

    var infowindow = new google.maps.InfoWindow(); 

    marker = new google.maps.Marker({ 
     position: new google.maps.LatLng(itemsPosition[0].latitud, itemsPosition[0].longitud), 
     icon: "http://labs.google.com/ridefinder/images/mm_20_blue.png", 
     map: map 
    }); 

    var marker, i; 
    for (i = 0; i < items.length; i++) { 
     marker = new google.maps.Marker({ 
      position: new google.maps.LatLng(items[i].latitud, items[i].longitud), 
      icon: "http://labs.google.com/ridefinder/images/mm_20_red.png", 
      animation: google.maps.Animation.BOUNCE, 
      map: map 
     }); 

     google.maps.event.addListener(marker, 'click', (function(marker, i) { 
      return function() { 
       marker.setAnimation(null); 

       infowindow.setContent("<div id='content'><h4>" + items[i].name + "</h4>" + items[i].dir + "<a id='ruta' href='" + showMap(items[i].latitud + "," + items[i].longitud) + "'>Ver Ruta</a></div>"); 

       infowindow.open(map, marker); 
      } 
     })(marker, i)); 
    } 

    // open navigator or native Maps App 
    function openMaps(latitud, longitud) { 
     window.open(showMap(latitud + "," + longitud), '_system'); 
    } 

    // url changes according to device 
    showMap = function(q) { 
     var device = navigator.userAgent; 
     var q = q.replace(/\s/g, "+"); 

     var url = "http://maps.google.com?saddr=" + itemsPosition[0].latitud + ',' + itemsPosition[0].longitud + "&daddr=" + q; 

     if (device.match(/Iphone/i) || device.match(/iPhone|iPad|iPod/i)) { 
      url = 'http://maps.apple.com/maps?saddr=Current%20Location&daddr=' + q 
     } else if (device.match(/Android/i)) { 
      url = "geo:0,0?q=" + q; 
     } else if (device.match(/Windows Phone/i)) { 
      url = "maps:" + q; 
     } 

     return url; 
    } 

答えて

1

: -

あなたは地理-URIとインテントオブジェクトを作成する必要があります。

String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); context.startActivity(intent);

+0

がハイブリッドでありますアプリ、そう、それはios、窓とアンドロイドのためです。それはhtml、css、jqueryを使ったJavaScriptです。 –

関連する問題