Choose Non-default googlecalendar with google-java-client-api

I want to get all the Calendars, which are in my GoogleAccount, using the google java client API.

In my application I want that a user can choose in wich calendar his events will be saved (not only in the default). But therefore I need their CalendarIDs. I don’t want that the users have to search their calendar ids to write them by hand into the app.

  • Use smartphone camera from a web app to scan QR code
  • Cordova Build Gradle Error while opening/extracting zip file
  • How to use Data Binding and Kotlin in Android Studio 3.0.0
  • How to copy selected files from Android with adb pull
  • Android wifi hotspot client connection events
  • Not able to get the TelephonyManager.CALL_STATE_RINGING
  • Would it be possible to create a new Calendar in his account, to write all the events in this new one.

    Sorry for my bad English.

    Related posts:

    TabLayout tab selection
    Android app video recording when screen off
    Set lock screen background in Android (like Spotify do)
    Android: Multiple view children for custom view with existing layout
    Espresso match first element found when many are in hierarchy
    How to display GIF in react-native android app?
  • Wrapping HTML in an app for Android
  • Android; fragments overlap when switching tabs
  • Android ScrollView clipping child elevation shadow
  • Using Android Studio with Vuforia
  • Is there any callback mechanism in android when there is data available to read in socket
  • Android Custom View doesn't handle transparency/alpha the right way
  • One Solution collect form web for “Choose Non-default googlecalendar with google-java-client-api”

    Yes of course it is possible.You only have to know the calendarId in which you want to save the new event, and use them with the event insert function.

    For example :

    Event event = new Event();
    
    event.setSummary("This is my Event");
    event.setLocation("127.0.0.1 -- Home sweet Home!!");
    
    ArrayList<EventAttendee> participants = new ArrayList<EventAttendee>();
    participants .add(new EventAttendee().setEmail("member@domain.com"));
    event.setAttendees(participants);
    
    DateTime start = new DateTime(new Date(), TimeZone.getTimeZone("UTC"));
    event.setStart(new EventDateTime().setDateTime(start));
    
    DateTime end = new DateTime(new Date(startDate.getTime() + 3600000), TimeZone.getTimeZone("UTC"));
    event.setEnd(new EventDateTime().setDateTime(end));
    
    Event createdEvent = service.events().insert("YourCalendarID", event).execute();
    

    Hope this could help you!

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.