Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
public CalendarEventEntry addEvent(String eventTitle, String eventContent, Calendar startCalTime, int durationMinutes, WebContent wc) throws ServiceException, IOException
{
CalendarEventEntry myEntry = new CalendarEventEntry();
myEntry.setTitle(new PlainTextConstruct(eventTitle));
myEntry.setContent(new PlainTextConstruct(eventContent));
myEntry.setQuickAdd(false);
myEntry.setWebContent(wc);
DateTime startTime = new DateTime(startCalTime.getTime(), TimeZone.getDefault());
startCalTime.add(Calendar.MINUTE, durationMinutes);
DateTime endTime = new DateTime(startCalTime.getTime(), TimeZone.getDefault());
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
return service.insert(eventFeedUrl, myEntry);
}
com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.extensions.EventEntry;
import com.google.gdata.data.extensions.When;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.URL;
public class TestMyCal {
/**
* @param args
*/
public static void main(String[] args) throws IOException,
ServiceException {
// Set up the URL and the object that will handle the
connection:
URL postUrl = new URL("[URL="http://www.google.com/calendar/feeds/MYEMAIL/private/full"]http://www.google.com/calendar/
feeds/MYEMAIL/
private/full[/URL]");
CalendarService myService = new CalendarService("exampleCo-
exampleApp-1");
myService.setUserCredentials("MYNAME", "MYPASSWORD");
EventEntry myEntry = new EventEntry();
myEntry.setTitle(new PlainTextConstruct("My test event"));
myEntry.setContent(new PlainTextConstruct("It might work."));
Person author = new Person("It's me", null, "[EMAIL="me@home.com"]me@home.com[/EMAIL]');
myEntry.getAuthors().add(author);
DateTime startTime = DateTime.parseDateTime
("2009-04-08T15:00:00-08:00");
DateTime endTime = DateTime.parseDateTime
("2009-04-08T17:00:00-08:00");
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
// Send the request and receive the response:
EventEntry insertedEntry = myService.insert(postUrl, myEntry);
}
}
package com.android.hello;
import android.app.Activity;
import android.os.Bundle;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.extensions.EventEntry;
import com.google.gdata.data.extensions.When;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set up the URL and the object that will handle the
connection:
URL postUrl = null;
try {
postUrl = new URL("[URL="http://www.google.com/calendar/feeds/MYEMAIL/private/full"]http://www.google.com/
calendar/feeds/MYEMAIL/
private/full[/URL]");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CalendarService myService = new CalendarService("exampleCo-
exampleApp-1");
try {
myService.setUserCredentials("MYNAME",
"MYPASSWORD");
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EventEntry myEntry = new EventEntry();
myEntry.setTitle(new PlainTextConstruct("My test event"));
myEntry.setContent(new PlainTextConstruct("It might work."));
Person author = new Person("It's me", null, "[EMAIL="me@home.com"]me@home.com[/EMAIL]');
myEntry.getAuthors().add(author);
DateTime startTime = DateTime.parseDateTime
("2009-04-08T15:00:00-08:00");
DateTime endTime = DateTime.parseDateTime
("2009-04-08T17:00:00-08:00");
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
try {
EventEntry insertedEntry = myService.insert
(postUrl, myEntry);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
setContentView(R.layout.main);
}
}
i want code for calendar application so pls provide me full code for that its urgent