Android Adding a new Calendar

后端 未结 1 1627
被撕碎了的回忆
被撕碎了的回忆 2021-02-13 06:46

I\'ve checked all over for ways to create a new calendar from within an Android app. The only way I\'ve seen is using the new Calendar API in the latest api version, BUT this on

1条回答
  •  鱼传尺愫
    2021-02-13 07:38

    Yes you can do it. But since you want to create a calendar linked with your google account, you need Google Calendar API for this (didn't find a single solution for doing this with Android Calendar Provider). Check below links:

    • Google calendar API for Android

    • Insert new Google Calendar

    Be sure to check their API explorer. Simple HTTP REQUEST for creating new calendar:

    POST https://www.googleapis.com/calendar/v3/calendars?key={YOUR_API_KEY}

    {
     "summary": "My new google calendar"
    }
    

    And it's RESPONSE:

    {
     "kind": "calendar#calendar",
     "etag": "__________etag_val_________",
     "id": "______id_goes_here______@group.calendar.google.com",
     "summary": "My new google calendar"
    }
    

    After that you should be able to manage this calendar from your Android app with Calendar Provider (after sync).

    0 讨论(0)
提交回复
热议问题