2011-05-01 26 views
2

GData API for Google Calendar in Javaを使用してGoogleカレンダーに接続するAndroidアプリを開発しています。これまではイベントを作成していましたが、タイトル、説明、時間のみを設定できました。GoogleカレンダーAPI:新しいイベントプロパティ

私はイベントに設定できるすべてのパラメータを持つリファレンスまたはサンプルをどこから見つけることができますか?

私はこれまでに達成したことのいくつかのコードを残します。

CalendarService calendarService = new CalendarService("CalendarAPP"); 
calendarService.setUserCredentials(<username>, <password>); 
URL postUrl = new URL("https://www.google.com/calendar/feeds/<GMAIL ACCOUNT>/private/full"); 
CalendarEventEntry myEntry = new CalendarEventEntry(); 

myEntry.setTitle(new PlainTextConstruct("Tennis with Beth")); 
myEntry.setContent(new PlainTextConstruct("Meet for a quick lesson.")); 

DateTime startTime = DateTime.now(); 
DateTime endTime = DateTime.now(); 
When eventTimes = new When(); 
eventTimes.setStartTime(startTime); 
eventTimes.setEndTime(endTime); 
myEntry.addTime(eventTimes); 

CalendarEventEntry insertedEntry = connection.getCalendarService().insert(postUrl, myEntry); 

ありがとうございます。

ミキワン。

答えて

1

GoogleカレンダーのGDataはかなり良いです。あなたが設定したり取得したりするかもしれないすべてのプロパティについて、GetterとSetterが定義されています。あなたはアクセスしたいデータに合ったイベントエントリーでセッター/ゲッターを探すだけです。

ほとんどの場合、コンソールに表示する方法の例を残しておきます。

お楽しみください!

private static void showCalendarEventEntry(CalendarEventEntry entry) { 
    assert entry != null; 
    System.out.println("-------------------------------------------"); 
    System.out.println("START showCalendarEventEntry"); 
    System.out.println(""); 
    System.out.println("ID: " + entry.getId()); 
    System.out.println("TITLE: "+entry.getTitle().getPlainText()); 
    System.out.println("DESCRIPTION: "+entry.getPlainTextContent()); 
    System.out.println("LOCATION: "+entry.getLocations().get(0).getValueString()); 

    System.out.println(""); 
    System.out.println("TIMES"); 
    if (entry.getTimes().size() > 0) { 
     When eventTimes = entry.getTimes().get(0); 
     if (eventTimes.getStartTime().isDateOnly()) { 
      System.out.println("\tWHEN: ALL DAY"); 
     } else { 
      System.out.println("\tWHEN: TIME"); 
     } 

     if (entry.getRecurrence() != null) 
      System.out.println("\tRECURRENCE: "+entry.getRecurrence().toString()); 

     System.out.println("\tSTART TIME: "+eventTimes.getStartTime()); 
     System.out.println("\tEND TIME: "+eventTimes.getEndTime()); 
    } 

    System.out.println(""); 
    System.out.println("PARTICIPANTS"); 
    System.out.println("\t"+(entry.getParticipants().size()) + " PARTICIPANTS"); 
    if (entry.getParticipants().size() > 0){ 

     for (int i=0; i<entry.getParticipants().size(); i++) { 
      EventWho participant = entry.getParticipants().get(i); 
      System.out.println("\t\tPARTICIPANT "+participant.getValueString()); 
      System.out.println("\t\t\tTYPE: "+participant.getAttendeeType()); 
      System.out.println("\t\t\tSTATUS: "+participant.getAttendeeStatus()); 
     } 
     if (entry.isGuestsCanInviteOthers()) 
      System.out.println("\tGUESTS CAN INVITE OTHERS: "); 
     if (entry.isGuestsCanModify()) 
      System.out.println("\tGUESTS CAN MODIFY"); 
     if (entry.isGuestsCanSeeGuests()) 
      System.out.println("\tGUESTS CAN SEE GUESTS"); 
    } 

    //REMINDERS 
    System.out.println(""); 
    System.out.println("REMINDERS"); 
    System.out.println("\t"+entry.getReminder().size()+" REMINDERS"); 
    if (entry.getReminder().size() > 0) { 
     for (int i=0; i<entry.getReminder().size(); i++) { 
      Reminder reminder = entry.getReminder().get(i); 
      System.out.println("\t\tREMINDER "+i); 
      System.out.println("\t\t\tMETHOD: "+reminder.getMethod().toString()); 
      System.out.println("\t\t\tDAYS: "+reminder.getDays()); 
      System.out.println("\t\t\tHOURS: "+reminder.getHours()); 
      System.out.println("\t\t\tMINUTES: "+reminder.getMinutes());     
     } 
    } 

    //VISIBILITY 
    System.out.println(""); 
    System.out.println("VISIBILITY: "+entry.getVisibility().getValue()); 

    System.out.println(""); 
    System.out.println("END showCalendarEventEntry"); 
    System.out.println("-------------------------------------------"); 
} 
関連する問題