[英]Google Calendar API: add latitude longitude to Calendar Event programmatically in android?
I retrieve the lat & long for the event detail. 我检索了有关事件详细信息的信息。 And I want to send lat long to calendar using intent.
我想使用意图将经纬度长时间发送到日历。 I search it on google but didn't find any solution?
我在Google上搜索但未找到任何解决方案? Please help.
请帮忙。
You could attain this using CalendarContract class. 您可以使用CalendarContract类实现此目的。 Adding location is possible using this class;
使用此类可以添加位置。
CalendarContract.Events.EVENT_LOCATION
More info here Adding event with reminders to calendar with 'Intent.putExtra()' way of doing 在此处获取更多信息使用“ Intent.putExtra()”方式将带有提醒的事件添加到日历
Using the Google API with other languages, I have been able to pass the Latitude and Longitude as a string and the map link in the Calendar Event drops a pin in the correct position. 通过将Google API与其他语言一起使用,我已经能够将纬度和经度作为字符串传递,并且日历事件中的地图链接将图钉放置在正确的位置。 I would imagine that that API has the same behavior for all languages.
我可以想象该API对于所有语言都具有相同的行为。
Source: Latitude and Longitude of the White House 资料来源: 白宫的经度和纬度
C# psuedo code C#伪代码
var latitude = "38.8976763";
var longitude = "-77.0365298";
new Event
{
// beginning parameters
...
// The comma is optional and replaceable with a single space
Location = $"{latitude}, {longitude}",
...
// final parameters
}
image from Event detail added by Google API: Google API添加的事件详细信息中的图片:
Resulting Link when clicking map from the Calendar Event: 从“日历事件”中单击地图时的结果链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.