Google показывает в браузере, но когда я запускаю команду ionic run android
это построить и успешно запустить приложение, но все работает отлично, за исключением карты Google нет ошибок в chrome://inspect
он просто говорит DEVICE READY FIRED AFTER 630 ms
, но не ошибка для google map. Я зарегистрировал приложение на console.developers.google.com получил ключ и использовал его в www/index.html
в голове, но все равно никаких изменений. Пожалуйста, помогите поблагодарить вас. home.ts
(функция Карта находится внутри этого файла)Google Map Issue - Ионный 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);
`
решил мою проблему. Спасибо за ваш ответ. –