Android google calendar deleting future instances of recurring event - android

I'm trying to delete future instances of a google calendar recurring (repeated) event pro-grammatically using content resolver.
And to do this i have updated the rRule of the event , so for example if want to delete future instances of an event starting from date 11/11/2016
i edit the rRule string to look like so:
FREQ=DAILY;UNTIL=20161111;WKST=SU
However , when viewing google calendar application i find no changes and i find the event color only has changed to black color.
Some notes to keep in mind:
1- I'm using a third party library to so :
https://github.com/EverythingMe/easy-content-providers
CalendarProvider calendarProvider = new CalendarProvider(context);
Event event = calendarProvider.getEvent(eventId);
event.rRule = "FREQ=DAILY;UNTIL=20161111;WKST=SU";
calendarProvider.update(event);
and all functionalities in this library seem to work fine.
2- While reading pro-grammatically recurring events that have a specific UNTIL date in it's rRule , i have realized that also a field in the google event called "lastDate" is updated with one hour later after the UNTIL value ,so do i have to update also this field while updating the UNTIL value in the rRule?

The problem was with the library ,
calendarProvider.update(event);
does not seems to work with all event fields!

Related

How to categorize calendar events in Android?

I intend to create an Android Application which manages Calendar Events. Unfortunately, I don't see a way in which I can present the user a way to add events for a given category, that the user might create.
Link to CalendarContracts.Events in official Android Documentation
The CalendarProcider.Events table doesn't seem to have any field, where I can store the category the event belongs to. Should I create a new calendar, linked to the same account, for each new category that I'd like to create? Is that the only way, if not the recommended one?
http://android.calengoo.com/pagedoc/pageinstallation/pageeventcolors/pageeventcolors.html
This link here argues that, perhaps different calendars should be created to represent the different categories.
Calendars in Google Calendar are like categories for your events. Just create additional calendars to categorize your events. E.g. you could create calendars named "Work", "Home", "Family", "Sports", "TV" and so on. By saving an event into a calendar the event will be displayed with the color of the calendar. An additional advantage when assigning colors to your events this way is that you can easily hide certain calendars/categories with a single tap by using the calendar selection bar.
I feel the reasoning is perfectly sane, and would provide the same functionality, unless there is another legit way to create categories within the same calendar.

Adding events to caldroid

am new to android. am creating a calendar using cal-droid library. I have set of data`s from the server, and I need to highlight those event dates in the calendar and also upon taping on a particular date, display the list of events for that date in list view below calendar view. Could any one please tell me any references or some sample codes for the same using Cal-droid.
use predefine method in caldroid Lib make sure you are supplying correct Format
dialogCaldroidFragment.setSelectedDates(formatter.parse("yourfromdate"),
formatter.parse("yourtodate"));
or use dialogCaldroidFragment.setBackgroundResourceForDates(formatter.parse("yourfromdate"));
link : https://github.com/roomorama/Caldroid/issues/34

Android - Block editable calendar event

I guess not, but just for trying. It is possible add an event programmatically and this event can't be edited anymore? The user just can delete the event, but he can't edit it, for example, he can't edit the date of event.
I think it's possible, but it's going to be complex. You should look at the Calendar Provider API and you may wish to see how the Last.fm app does things.
try to put the content value CalendarContract.Events.IS_ORGANIZER to true for the event and CalendarContract.Calendars.OWNER_ACCOUNT with the email of the user account when you create the calendar.

Create syncable android calendar programmatically

i developed an app-feature to create and sync a local phone calendar through an app. Now i have to sync this calendar online, best through the native phone account.
I tried to extend the URI's content values parameter (see API LVL < 8 parameter list below) by the account name and type but running after that into calendar freezes.
_id
sync_account
_sync_account_type
_sync_id
_sync_version
_sync_time
_sync_local_id
_sync_dirty
_sync_mark
url
name
displayName
hidden
color
access_level
selected
sync_events
location
timezone
ownerAccount
Is there another way to create an online syncable google calendar?
You cannot create a new one programatically.
Instead parse all available ones with
Uri.parse("content://com.android.calendar/calendars",null, null, null, null);
and fill in your events into a existing one.
But ensure, that your event got the same
sync_account
and
_sync_account_type

How to get android calendar event when I have event ID

Is it possible to get calendar event when I have specific ID or it is necessary to read all events and compare to my ID?
Thank you
I think is better to find it based on information of the event(title,description),because when you want to edit a speceific event meanwhile the user can delete himself your event,and create another event which might have the same ID as yours.So you will get the wrong event to edit.
So i think is safer to find your's choice event based to title or description ...
For example if you want to delete an event(android 2.2 example):
getContentResolver().delete(Uri.parse("content://com.android.calendar/events"), "title=? and description=?", new String[]{"The title of the event", "Description of the event"});

Categories

Resources