I use the following code in Java. It works well and it adds events into Google Calendar. But in Android it gives the Exception Error connecting with login URI
. Can anyone help me to solve this?
CalendarService myService = new CalendarService("calendarTest");
String userName = "mytest.test@gmail.com";
String userPassword = "xxxxxxx";
// Create the necessary URL objects.
try {
metafeedUrl = new URL(METAFEED_URL_BASE + userName);
eventFeedUrl = new URL(METAFEED_URL_BASE + userName
+ EVENT_FEED_URL_SUFFIX);
} catch (MalformedURLException e) {
// Bad URL
strbuf.append(e.getMessage());
System.err.println("Uh oh - you've got an invalid URL.");
e.printStackTrace();
return;
}
try
{
myService.setUserCredentials(userName, userPassword);
// Demonstrate creating a single-occurrence event.
CalendarEventEntry singleEvent = createSingleEvent(myService,"Event Title", "Event Description ");
System.out.println("Successfully created event " +singleEvent.getTitle().getPlainText() );
// Demonstrate creating a quick add event.
CalendarEventEntry quickAddEvent = createQuickAddEvent(myService,"Tennis with me June 22 3pm-3:30pm");
System.out.println("Successfully created quick add event " + quickAddEvent.getTitle().getPlainText());
}
// catch.......