We are trying to show user the Ice cream Sandwich calendar view, when they want to add a new event. We can only test this in emulator.
The other problem is that we can't find any examples how to use CalendarProvider. This is the right class when it comes to dealing with Sandwich calendar?
Would this be easier to do with Google Gdata API?
[EDIT] So what we got working was adding an event to calendar but it was not through the API, we open the calendar in the correct view. But now the problem is that it does not work in the emulator because we haven't been able to get the calendar synced.
So the question is: How to read and possibly edit Android calendar events using the new Android 4.0 Ice Cream Sandwich API?
I used the following code to read all the events in Calendar.
Make sure,you are not using 'visibilty' for ICS and JellyBean devices (apiLevel>=14)
Try this -
Use visibility only if device version is less than 14(ICS)
Here's code that will let you add an event directly:
You'll need the CALENDAR_ID, so here's how to query the list of calendars:
You'll need to request the
android.permission.READ_CALENDAR
permission for all of this to work.If you want to avoid having to request permissions, you can also ask the Calendar app to create a new event on your behalf by using an
Intent
:You can use the following code to setup the timezone and it works for me
I have creted following Method to handle the flexibility of TIMEZONE
// Converting TimeZone in to GMT to save upon local Db to avoid // Controversy Over Server