如何应对在用户的日历开始活动 [英] how to respond to start of event in user's calendar

查看:92
本文介绍了如何应对在用户的日历开始活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,当在用户的日历中的活动开始或结束时要执行的操作。是否有一个BroadcastReceiver或东西,可以帮助我做到这一点?

I want to perform an action when an event in the user's calendar starts or ends. Is there a BroadcastReceiver or something that can help me do this?

推荐答案

有良好来源,用于读取Android开发者的网站日历。的http://developer.android.com/guide/topics/providers/calendar-provider.html#instances
作为查询日历。
并有后台很好的教程为计划任务 http://www.sitepoint.com/调度背景任务功能的Andr​​oid /

There is good source for reading calendar in android developer's site. http://developer.android.com/guide/topics/providers/calendar-provider.html#instances As Querying a calendar. And there is good tutorial for scheduling tasks at background http://www.sitepoint.com/scheduling-background-tasks-android/

编辑:

使用

cursor_event.getLong(cursor_event.getColumnIndex("dtstart")); 

获取时间,因为时代在UTC米利斯的事件开始。

to get time the event starts in UTC millis since epoch.

要获得活动结束时间使用

To get event end time use

cursor_event.getLong(cursor_event.getColumnIndex("dtend"));

所有的事件列,你可以在这里找到<一个href=\"http://developer.android.com/reference/android/provider/CalendarContract.EventsColumns.html#DTEND\" rel=\"nofollow\">http://developer.android.com/reference/android/provider/CalendarContract.EventsColumns.html#DTEND
当然,你必须使用此columnindexs DTSTART等则必须在广播接收我给上面sitepoint.com链接
让我知道您的问题解决了。

All event columns you can find here http://developer.android.com/reference/android/provider/CalendarContract.EventsColumns.html#DTEND And of course you must use this columnindexs dtstart etc. you must you broadcast receiver i gave the link above sitepoint.com Let me know if your issue solved.

这篇关于如何应对在用户的日历开始活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆