gpt4 book ai didi

Android 与谷歌地图位置和 URL Shortener API 共享 Intent

转载 作者:行者123 更新时间:2023-11-30 00:14:31 25 4
gpt4 key购买 nike

我正在尝试与纬度和经度共享一个位置;

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?"));

我想做的是:

Image taken from Whatsapp Windows app

我正在使用 URL shortener api 并将 "http://maps.google.com/maps?daddr="+ latLngMaps.latitude + ","+ latLngMaps.longitude; 转换为 goo .gl/xxxxx

变成这样Shared from my app

当我在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com