Create syncable android calendar programmatically

2019-07-20 19:37发布

问题:

i developed an app-feature to create and sync a local phone calendar through an app. Now i have to sync this calendar online, best through the native phone account. I tried to extend the URI's content values parameter (see API LVL < 8 parameter list below) by the account name and type but running after that into calendar freezes.

_id
sync_account
_sync_account_type
_sync_id
_sync_version
_sync_time
_sync_local_id
_sync_dirty
_sync_mark
url
name
displayName
hidden
color
access_level
selected
sync_events
location
timezone
ownerAccount

Is there another way to create an online syncable google calendar?

回答1:

You cannot create a new one programatically. Instead parse all available ones with

Uri.parse("content://com.android.calendar/calendars",null, null, null, null);

and fill in your events into a existing one.

But ensure, that your event got the same

sync_account

and

_sync_account_type