Delete Calendar Event

Post your questions and help other users.

Moderator: Martin

Post Reply
atuguesp
Posts: 7
Joined: 21 Oct 2013 02:29

Delete Calendar Event

Post by atuguesp » 15 Mar 2015 23:12

Hi, how can i delete an event from the calendar with the Action: Start Activity?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Delete Calendar Event

Post by Martin » 17 Mar 2015 13:29

Hi,

I fear that it's not possible to delete a calendar entry with action Start Activity. The calendar app seems not to support the delete-intent (at least not the calendar app from Google).
For the moment you probably have to resort to Execute Root Command with a command like content delete --uri content://com.android.calendar/events/751 where 751 is the ID of the event you want to delete.

Regards,
Martin

atuguesp
Posts: 7
Joined: 21 Oct 2013 02:29

Re: Delete Calendar Event

Post by atuguesp » 17 Mar 2015 18:50

Thanks Martin for answering so fast, I will try Execute Root Command.

Regards,

Alfredo.

atuguesp
Posts: 7
Joined: 21 Oct 2013 02:29

Updating a Calendar Event without editing it

Post by atuguesp » 25 Mar 2015 18:21

Hi Martin, how can I do this with Automagic:

"Updating Events

When your application wants to allow the user to edit an event, we recommend that you use an EDIT Intent, as described in Using an intent to edit an event. However, if you need to, you can edit events directly. To perform an update of an Event, you can provide the _ID of the event either as an appended ID to the Uri (withAppendedId()) or as the first selection item. The selection should start with "_id=?", and the first selectionArg should be the _ID of the event. You can also do updates using a selection with no ID. Here is an example of updating an event. It changes the title of the event using the withAppendedId() approach:

private static final String DEBUG_TAG = "MyActivity";
...
long eventID = 188;
...
ContentResolver cr = getContentResolver();
ContentValues values = new ContentValues();
Uri updateUri = null;
// The new title for the event
values.put(Events.TITLE, "Kickboxing");
updateUri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
int rows = getContentResolver().update(updateUri, values, null, null);
Log.i(DEBUG_TAG, "Rows updated: " + rows); "

From: http://developer.android.com/guide/topi ... date-event

Regards,

Alfredo.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Delete Calendar Event

Post by Martin » 26 Mar 2015 19:45

Hi Alfredo

Automagic does not provide an action to update values but you could also use the content command using Execute Root Command.
The command in this case would look like this:
content update --uri content://com.android.calendar/events/188 --bind title:s:Kickboxing

188 is the eventId
title:s:Kickboxing tells to update column title with a String (s) to value Kickboxing.

Here's the description provided by command content:
<COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where:
<TYPE> specifies data type such as:
b - boolean, s - string, i - integer, l - long, f - float, d - double
Note: Omit the value for passing an empty string, e.g column:s:

Regards,
Martin

atuguesp
Posts: 7
Joined: 21 Oct 2013 02:29

Re: Delete Calendar Event

Post by atuguesp » 27 Mar 2015 10:09

Thanks Martin, I'll try. I must congratulate you for the great service you have.

Regrads,
Alfredo.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Delete Calendar Event

Post by bogdyro » 24 Sep 2015 12:09

Hello. Weird problem. Trying to delete a calendar event with this command
content delete --uri content://com.android.calendar/events/215
I'm getting this error msg in stdout
[ERROR] Unsupported operation: delete --uri content://com.android.calendar/events/215
the device is a sony sgp611 tablet,rooted with kingroot.
Running the same command in a terminal emulator works with no error messages.
I son't know what the problem is. The same action ran on another device-htc phone- works ok.
Maybe it's the rooting methox on the tablet. Any ideeas?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Delete Calendar Event

Post by Martin » 24 Sep 2015 19:16

The command looks good to me. Maybe kingroot messes something up but I'm not aware about problems in this area.
What happens when you just execute an action Execute Root Command: content delete (I would expect an output like [ERROR] Content provider URI not specified. Did you specify --uri argument?).
What about Execute Root Command: content delete --uri (I would expect [ERROR] No value for argument: --uri).

Can you please share the flow containing the action so I can check if I see anything suspicious?

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Delete Calendar Event

Post by bogdyro » 26 Sep 2015 21:38

Actually I solved it. Just works after restarting the tablet. Don't know what that had to do with anything. Thx Martin

Post Reply