title: How to add new calendar to google account on android?
body: <p>I am writing an android application which uses the Android Calendar API. I am trying to add a calendar from my app to the primary google account on the device so that it is synced with google calendar online.</p>
  
  <p>My app implements a sync adapter and stores its own account on the device. In the sync adapter I insert the calendar and insert all the events for the calendar.</p>
  
  <p>I have been able to add the calendar to the Calendar Storage under my apps account name and type and it displays in the android calendar app and persists. It does not sync with Google calendar online which is my main goal for adding it to the Calendar Storage.</p>
  
  <p>I've tried to change this code so that the calendar is added to the primary google account by changing the account name and type used in the values for <code>Calendars.ACCOUNT_NAME</code> and <code>Calendars.ACCOUNT_TYPE</code> to those of the primary google account. A calendar is inserted and an id returned but after my app is finished syncing the Calendar has disappeared and my app is unable to find it. I know its gone because I use a constant value to find it which works when I add the calendar using my apps account.</p>
  
  <p>Does anybody know how I can add a calendar to the primary google account (or any google account) on the device, have it persist, so that it syncs with google calendar online?</p>
  
  <p>I am beginning to think it isn't possible for some reason as I can't see anybody else having accomplished this and any calendar app I've found only seems to be able to add local calendars to the android phone using the Calendar API or uses their own cloud storage.</p>
  
  <p>I would be grateful for even a step in the right direction.</p>