问题
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