我怎样才能修复"错误的登录URI&QUOT连接;例外,我添加事件,谷歌日历的时候得到什么呢?什么呢、日历、错误、时候

2023-09-04 02:57:00 作者:独守一人心、誓死不分离

我用下面的code在Java中。它运作良好,并把它添加到事件谷歌日历。但在Android的它给人的异常错误的登录URI 连接。谁能帮我解决此问题?

  CalendarService为myService =新CalendarService(calendarTest);
字符串username =mytest.test@gmail.com;
字符串的userPassword =XXXXXXX;

//创建必要的URL对象。
尝试 {
    metafeedUrl =新的URL(METAFEED_URL_BASE +用户名);
    eventFeedUrl =新的URL(METAFEED_URL_BASE +的userName
        + EVENT_FEED_URL_SUFFIX);
}赶上(MalformedURLException异常E){
    //错误的URL
    strbuf.append(e.getMessage());
    通信System.err.println(嗯哦 - 你有一个无效的URL。);
    e.printStackTrace();
    返回;
}

尝试
{
    myService.setUserCredentials(用户名,userPassword的);
    //演示创建一个单一事件的发生。
    CalendarEventEntry singleEvent = createSingleEvent(为myService活动名称,事件说明);
    的System.out.println(成功创建活动+ singleEvent.getTitle()getPlainText());

    //演示创建一个快速添加事件。
    CalendarEventEntry quickAddEvent = createQuickAddEvent(为myService,6月22日3 pm-3:30pm网球与我);
    的System.out.println(成功创建快速添加事件+ quickAddEvent.getTitle()getPlainText());

}
// 抓住.......
 

解决方案

这需要互联网接入来添加一些东西到日历,对不对?

所以,你需要给你的应用程序访问Internet的权限。尝试AndroidManifest.xml中的结束标记之前加入这一权利:

 <使用-权限的Andr​​oid:名称=android.permission.INTERNET对>< /使用-许可>
 
连接错误800怎么解决

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.......

解决方案

This needs internet-access to add something to the calendar, right?

So you need to give your app the permission for internet access. Try adding this right before the closing tag of AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>