首页 > 解决方案 > 谷歌静态地图 API url 在 android 中不起作用

问题描述

我们在我们的 ionic 应用程序中使用静态谷歌地图 url,该应用程序在 IOS 中运行良好,但在 android 中无法运行。我们将 API 密钥与 URL 一起附加,并且该 URL 在桌面浏览器和 iOS 设备上工作。但它不适用于 android 设备并显示空白(白色)空间。我在 home.scss 下面有以下代码

testmap-image {

  .mapcontainer {

position: relative;

img-loader {

  width: 100%;
  height: 100px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;

  ion-spinner {
    height: 100px;
  }
}
  }
}

主页.html

<div class="map-container">
  <img-loader *ngIf="getUrl"
              [src]="getUrl"
              width="100%"
              height="100px"
              backgroundSize="cover"
              backgroundPosition="center"  
              >
    </img-loader>
</div>

在上面的代码中,我从 getUrl() 方法获得了正确的 URL。

网址是: https://maps.googleapis.com/maps/api/staticmap?center=,22 , market street, mumbai,India&zoom=15&​​size=650x150&key=xxxxxxxxxxxxxxxxxxxxx

您能否让我知道可能是什么问题以及为什么它无法在 android 设备上运行?

问候

标签: androidcordovaionic-frameworkgoogle-static-maps

解决方案


推荐阅读