i have an application in which i need to sync the events that i get from an xml to the default calendar provided in the users phone.
for the above i have referred this tutorial.But over here the first it is required to get the id and name of all the available calendars in the users phone... i don't know the id and name of the default calendar in the users phone....which calendar should i use to put events in?
i am not putting the code here as the code is present in the link given.
thank you in advance.
You can't know ahead of time. There is no system setting for the default calendar. You must account for this in your application by allowing the user to select the calendar or coming up with your own way of determining the "default".
Be careful not to rely on the persistence of any calendar because if they are Google calendars they will come and go with corresponding changes in the cloud.
Related
In the Android calendar app one can activate certain calendars, like holidays or birthdays. In the case of holidays I suppose the data comes from Google, in the case of birthdays the data comes from my contacts.
I would like my app to provide such calendar data. The data would be generated by my app, the Calendar app would simply display it. I would like my app to show up among the aforementioned list of calendars in the Calendar app, like holidays and birthdays, where the user may activate it and choose a color.
To make things clear: I don't want my app to access the Calendar app, but the other way around: the Calendar app would access the calendar data provided by my app.
Is this possible in the way I describe? What API do I have to implement?
If this is not possible this way, is there another way that comes close to what I'm describing?
Or is the only way to provide data to the Calendar to ask write permission for the Calendar and add events?
I created an Android app that read all the events of the calendar, it's work fine but I can't read the list of reminders: the simplified event in the Google calendar identified by this icon (knot on the finger)
Google Calendar Reminder
Someone can tell me how can I read this type of event or where can I find a tutorial or a guide where this is explained?
If you want to fetch list of reminders, use Events.list. It returns events and the accompanying reminders.
Default reminders
Default reminders are also returned when
doing an Events list query.
I discovered that the reminders aren't only on calendar but are in different Google app (keep for example).
Unfortunately it's not possible to access a this kind of data.
This the link of the answer in Stackoverflow: How to read reminders in google calendars
According to OferR The Reminders data is held in a database and accessible by the 'com.google.android.gms.reminders.provider.RemindersProvider' content provider.
So, the provider is not exported and therefore is not accessible to third party apps.
I have created a custom Calendar in android, kept in sync with a remote server via SyncAdapter using a custom Account with a custom AccountType.
The sync works fine and my app on the device has an activity that allows the user to insert edit and delete events in my custom calendar.
The only "problem" is the usability,
since the user wants to use the standard calendar app present on the device, because he's used to it's interface, etc.
Actually when I open my events from the standard calendar app, I can see the details of the event but there is no edit or delete function available.
In order to edit such appointments the user must close the standard calendar app, open my app (which should provide a list of the events and then edit them.)
Is it possible to let the system know that there is my App on the device with a specific Activity that is able to perform operations like edit or delete on the events belonging to my custom calendar which has a specific account type ?
Any Idea on how to achieve this?
Thanks in advance.
I have created an application which contains certain date option.
Now suppose on some date I have write notes my app.
Now when I press my submit button, these notes are save in the device calendar.
So, is it possible to save the data that you used in your application directly in the device calendar based on the date you have selected for saving data? Moreover, when I delete my data from the app, the data saved in the device calendar is also deleted.
Take a look at this link: http://code.google.com/apis/calendar/data/2.0/developers_guide.html
There is a Java library for API version 2.0. Try using that to modify a particular user's Google Calendar.
You can find the current user's e-mail ID (Google account) from this question: How can you get an Android user's email address?
Update:
Here is a sequence that might work:
Authentication - The first step would be to have the user login into his Google account. Link: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
List calendars - Next, ask the user to select which calendar he wants to use. Check here to see how to get list of calendars: http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html#RetrievingCalendars
Add Event - Finally, add the event to the selected calendar: http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html#CreatingSingle
Obviously there might be steps I have missed. Do try these out and read the documentation to see if some steps are required in between
To modify a user's Google Calendar, use the Google Calendar GData API.
Can i get informed in my android application when a user adds a new entry in his calendar application (i.e. via listeners, ...) or is checking the calendar every now and then via the content provider of the calendar app the only solution to find out if the user has added new entries ?
Can i get informed in my android
application when a user adds a new
entry in his calendar application
(i.e. via listeners, ...)
There is no calendar application in the Android SDK. There is a calendar application in the open source project, but it may or may not exist on any given device, since device manufacturers are welcome to replace it. It is also possible that the user will download an alternative calendar application that replaces the built-in one.
is checking the calendar every now and
then via the content provider of the
calendar app the only solution to find
out if the user has added new entries
?
There is no calendar content provider in the Android SDK. There is a content provider used by the calendar application in the open source project, but see above for the issues with relying upon that application. Also, the core Android team wishes that you would not rely upon undocumented content providers.
If you wish to work with Google Calendar, please use the appropriate GData APIs, until and unless more calendar functionality is added to the SDK.