We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to write a Processing program for Android that can create an event in Google Calender.
I've written a program, that creates a .csv file which through this method can be imported into Google Calendar via a computer: support.google.com/calendar/answer/37118?hl=en
Transfering a .csv file from my phone to a computer, just to create an event in google Calendar, is obviously not a very user friendly method. As both the 'READ_CALENDAR' and 'WRITE_CALENDAR' permissions are present in Android Mode, there must be a proper way to create an event in Google Calendar with Processing, and yet the closest i've gotten to finding a solution, is this one from Google's website: developer.android.com/guide/topics/providers/calendar-provider.html#intent-insert
Calendar beginTime = Calendar.getInstance();
beginTime.set(2012, 0, 19, 7, 30);
Calendar endTime = Calendar.getInstance();
endTime.set(2012, 0, 19, 8, 30);
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(Events.CONTENT_URI)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis())
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis())
.putExtra(Events.TITLE, "Yoga")
.putExtra(Events.DESCRIPTION, "Group class")
.putExtra(Events.EVENT_LOCATION, "The gym")
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY)
.putExtra(Intent.EXTRA_EMAIL, "rowan@example.com,trevor@example.com");
startActivity(intent);
Is it possible to adapt the code in the link above, in order to create an event in Google Calendar using Processing for android, or use some other method and if so, how?
This thread is somewhat similar to this one: forum.processing.org/two/discussion/18459/using-the-google-calendar-api/p1
Answers
The solution to my problem was to add:
import java.util.Calendar; import android.provider.CalendarContract; import android.provider.CalendarContract.Events; import android.content.Intent;