Android:是否可以在不调用Google日历API或启动本机日历活动的情况下添加日历事件?
我想问一下,是否可以在不调用Google日历API(需要internet连接)或启动本机日历活动(不需要)的情况下添加日历事件?只需将日历事件添加到设备本机日历中(无需读取、筛选等)Android:是否可以在不调用Google日历API或启动本机日历活动的情况下添加日历事件?,android,calendar,Android,Calendar,我想问一下,是否可以在不调用Google日历API(需要internet连接)或启动本机日历活动(不需要)的情况下添加日历事件?只需将日历事件添加到设备本机日历中(无需读取、筛选等) 非常感谢您的任何建议是的,可以启动本机日历活动 Intent calendarIntent = new Intent(Intent.ACTION_INSERT, Events.CONTENT_URI); Calendar beginTime = Calendar.getInstance().set(2012
非常感谢您的任何建议是的,可以启动本机日历活动
Intent calendarIntent = new Intent(Intent.ACTION_INSERT, Events.CONTENT_URI);
Calendar beginTime = Calendar.getInstance().set(2012, 0, 19, 7, 30);
Calendar endTime = Calendar.getInstance().set(2012, 0, 19, 10, 30);
calendarIntent.putExtra(CalendarContract.EXTRA\u EVENT\u BEGIN\u TIME,beginTime.getTimeInMillis());
calendarIntent.putExtra(CalendarContract.EXTRA\u EVENT\u END\u TIME,endTime.getTimeInMillis());
calendarIntent.putExtra(Events.TITLE,“忍者职业”);
calendarIntent.putExtra(Events.EVENT_位置,“秘密道场”)
现在开始上面的活动。希望能有帮助。我想你要找的是。(另见) 您可以使用它来读取、写入、更新和删除日历事件。尽管您需要日历权限,但:
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
然后,您可以只使用用户日历或创建自己的日历。但是您的示例将使用预先填充的值启动默认日历应用程序(活动)。