Android Calendar Provider does not return latest data

爷,独闯天下 提交于 2020-05-16 22:39:07

问题


I am using the following code:

String selection = "((dtstart >= " + now
        + ") AND (dtend <= " + endTime.getTimeInMillis() + "))";
Cursor cursor = context.getContentResolver()
        .query(Uri.*parse*("content://com.android.calendar/events"),
                *PROJECTION*, selection,null, null);

And I notice that once I add/remove an Event to Google Calendar app on the device and run the above code immediately, occasionally I do not get the latest dataset from the Cursor. I have to manually refresh the Google Calendar app to get the latest data.

Am I missing something? Can I use some other APIs?

Thanks!


回答1:


To get latest data after adding event to calendar you can listen calendar for event changes



来源:https://stackoverflow.com/questions/61012807/android-calendar-provider-does-not-return-latest-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!