作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试与纬度和经度共享一个位置;
String uri = "http://maps.google.com/maps?daddr=" + latLngMaps.latitude + "," + latLngMaps.longitude;
使用这些代码行:
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String ShareSub = pharmacyName + "\n" + pharmacyAddress;
sharingIntent.putExtra(Intent.EXTRA_TEXT, ShareSub + "\n" + shortURL);
startActivity(Intent.createChooser(sharingIntent, "Share With?"));
我想做的是:
我正在使用 URL shortener api 并将 "http://maps.google.com/maps?daddr="+ latLngMaps.latitude + ","+ latLngMaps.longitude;
转换为 goo .gl/xxxxx
当我在 Whatsapp 上分享我的 map 时,是否可以获得第一个图像的 View ?
如果不是,如何将我的链接缩短为 goo.gl/maps/xxxx 而不是 goo.gl/xxxx?
最佳答案
您需要使用 Google 静态 map API,它将 map 作为图像返回,您可以通过 intent 共享它。您还可以自定义静态 map API,例如可以设置标记位置、设置缩放级别。
Url
https://maps.googleapis.com/maps/api/staticmap?center=Australia&size=640x400&style=element:labels|visibility:off&style=element:geometry.stroke|visibility:off&style=feature:landscape|element:geometry|saturation:-100&style=feature:water|saturation:-100|invert_lightness:true&key=YOUR_API_KEY
您还可以使用谷歌地图选项使用谷歌地图的精简版。它也显示为图像。可以点击,也有谷歌地图定制。
visit my website for learnning Kotlin and Android - Developine
关于Android 与谷歌地图位置和 URL Shortener API 共享 Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47522022/
leaflet:一个开源并且对移动端友好的交互式地图 JavaScript 库 中文文档: https://leafletjs.cn/reference.html 官网(英文): ht
我是一名优秀的程序员,十分优秀!