0

のGoogleマップは、ブラウザに表示されますが、私は、コマンドに ionic run android を実行したときにそれが正常にビルドしてアプリを起動しかし、すべてはそれだけでDEVICE READY FIRED AFTER 630 msが、エラーなしを言うchrome://inspectにエラーがないのGoogleマップを除いて正常に動作しますGoogleマップ用私はconsole.developers.google.comのアプリを登録して、鍵を手に入れて、でそれを使用しましたが、まだ変更はありません。ありがとうございます。 home.ts(地図機能は、このファイルの中にある)Googleマップの問題 - イオンは2

// Get the current location 
    Geolocation.getCurrentPosition().then((position) => { 
    // Set latitude and longtitude variable 
    this.lat = position.coords.latitude; 
    this.long = position.coords.longitude; 

    // This function will get the name of the city where user is located 
    this.getCityName(this.lat, this.long); 

    // this function sets up the google map 
    let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 

    let mapOptions = { 
    center: latLng, 
    zoom: 11, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    } 
    var mapi = new google.maps.Map(this.mapDiv.nativeElement, mapOptions); 
    // Below code is provided by a ai pollution control website (http://aqicn.org/faq/2015-09-18/map-web-service-real-time-air-quality-tile-api/) 
    // haven't changed anything in below code copied as it is from web 
    var waqiMapOverlay = new google.maps.ImageMapType({ 
       getTileUrl: function(coord, zoom) { 
         return 'http://tiles.aqicn.org/tiles/usepa-aqi/' + zoom + "/" + coord.x + "/" + coord.y + ".png?token=_TOKEN_ID_"; 
       }, 
       name: "Air Quality", 
    }); 
    // Insert above received data into map 
    mapi.overlayMapTypes.insertAt(0,waqiMapOverlay); 

`

答えて

0

おそらくあなたのマップは、マップではない理由です、座標(position.coords.latitude、position.coords.longitude)を取得していませんレンダリング。 navigator.Geoloaction.getCurrentPosition ...を試すか、ユーザージオロケーションを取得するためにプラグインが必要かどうかを確認してください。 &は、フォールバック座標を与えることを好みます。

this.lat = position.coords.latitude || "21.1610858"; 
this.long = position.coords.longitude || "79.0725101"; 
+0

私の問題を解決しました。あなたの答えをありがとう。 –

関連する問題