【问题标题】:How to use google calendar api in android?如何在 Android 中使用谷歌日历 API?
【发布时间】:2012-05-10 09:16:27
【问题描述】:

大家好,我是安卓新手。我解析了日历文件。我需要从我的应用程序中将事件添加到 Google 日历。我正在使用eclipse ide。在eclipse中如何使用谷歌日历api?使用日历api需要jar文件吗?

【问题讨论】:

  • 你有没有从谷歌得到你的 API 密钥?如果没有,那么首先你必须得到谷歌日历 API 密钥

标签: android google-calendar-api


【解决方案1】:

使用此代码:

Intent intent = new Intent(Intent.ACTION_EDIT);  
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);

这里也讨论过How to launch Android Calendar application using Intent (Froyo) 此外,这可能无法在某些设备上完美运行,例如 endTime 无法在 HTC wildfire 上运行。

【讨论】:

    【解决方案2】:

    在 ICS 版本中,有一个用于管理日历数据的官方 API: http://developer.android.com/reference/android/provider/CalendarContract.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-21
      • 1970-01-01
      • 1970-01-01
      • 2017-03-25
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      • 2016-04-15
      相关资源
      最近更新 更多