List of usage examples for android.provider CalendarContract CALLER_IS_SYNCADAPTER
String CALLER_IS_SYNCADAPTER
To view the source code for android.provider CalendarContract CALLER_IS_SYNCADAPTER.
Click Source Link
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private static Uri buildCalUri() { return CalendarContract.Calendars.CONTENT_URI.buildUpon() .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, ACCOUNT_NAME) .appendQueryParameter(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL).build(); }
From source file:com.openerp.support.calendar.OECalendar.java
/** * As sync adapter.//from w w w . ja v a2 s. c om * * @param uri * : uri of the calendar * @param account * : with OpenERP Mobile Calendar created * @param accountType * : with OpenERP Mobile Calendar created * @return uri : with uri + account + accounttype */ private Uri asSyncAdapter(Uri uri, String account, String accountType) { return uri.buildUpon().appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, account) .appendQueryParameter(Calendars.ACCOUNT_TYPE, accountType).build(); }
From source file:com.nineash.hutsync.client.NetworkUtilities.java
private static long getCalendar(Account account) { // Find the Last.fm calendar if we've got one Uri calenderUri = Calendars.CONTENT_URI.buildUpon() .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type).build(); Cursor c1 = mContentResolver.query(calenderUri, new String[] { BaseColumns._ID }, null, null, null); if (c1.moveToNext()) { long ret = c1.getLong(0); c1.close();/*from w ww. j a va 2 s . c o m*/ return ret; } else { ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>(); ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(Calendars.CONTENT_URI .buildUpon().appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type).build()); builder.withValue(Calendars.ACCOUNT_NAME, account.name); builder.withValue(Calendars.ACCOUNT_TYPE, account.type); builder.withValue(Calendars.NAME, "Pizza Hut Shifts"); builder.withValue(Calendars.CALENDAR_DISPLAY_NAME, "Pizza Hut Shifts"); builder.withValue(Calendars.CALENDAR_COLOR, 0xD51007); builder.withValue(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_READ); builder.withValue(Calendars.OWNER_ACCOUNT, account.name); builder.withValue(Calendars.SYNC_EVENTS, 1); operationList.add(builder.build()); try { mContentResolver.applyBatch(CalendarContract.AUTHORITY, operationList); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return -1; } c1.close(); return getCalendar(account); } }
From source file:at.bitfire.ical4android.AndroidCalendar.java
public static Uri syncAdapterURI(Uri uri, Account account) { return uri.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").build(); }
From source file:at.bitfire.ical4android.AndroidCalendar.java
public Uri syncAdapterURI(Uri uri) { return uri.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").build(); }
From source file:com.granita.contacticloudsync.syncadapter.AccountSettings.java
@SuppressWarnings("Recycle") private void update_0_1() throws URISyntaxException { String v0_principalURL = accountManager.getUserData(account, "principal_url"), v0_addressBookPath = accountManager.getUserData(account, "addressbook_path"); Constants.log.debug("Old principal URL = " + v0_principalURL); Constants.log.debug("Old address book path = " + v0_addressBookPath); URI principalURI = new URI(v0_principalURL); // update address book if (v0_addressBookPath != null) { String addressBookURL = principalURI.resolve(v0_addressBookPath).toASCIIString(); Constants.log.debug("New address book URL = " + addressBookURL); accountManager.setUserData(account, "addressbook_url", addressBookURL); }/* w w w . j av a2 s .co m*/ // update calendars ContentResolver resolver = context.getContentResolver(); Uri calendars = Calendars.CONTENT_URI.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").build(); @Cleanup Cursor cursor = resolver.query(calendars, new String[] { Calendars._ID, Calendars.NAME }, null, null, null); while (cursor != null && cursor.moveToNext()) { int id = cursor.getInt(0); String v0_path = cursor.getString(1), v1_url = principalURI.resolve(v0_path).toASCIIString(); Constants.log.debug("Updating calendar #" + id + " name: " + v0_path + " -> " + v1_url); Uri calendar = ContentUris.appendId( Calendars.CONTENT_URI.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true"), id).build(); ContentValues newValues = new ContentValues(1); newValues.put(Calendars.NAME, v1_url); if (resolver.update(calendar, newValues, null, null) != 1) Constants.log.debug("Number of modified calendars != 1"); } accountManager.setUserData(account, "principal_url", null); accountManager.setUserData(account, "addressbook_path", null); accountManager.setUserData(account, KEY_SETTINGS_VERSION, "1"); }
From source file:com.nineash.hutsync.client.NetworkUtilities.java
private static ContentProviderOperation updateEvent(long calendar_id, Account account, Event event, long raw_id) { ContentProviderOperation.Builder builder; if (raw_id != -1) { builder = ContentProviderOperation.newUpdate(Events.CONTENT_URI.buildUpon() .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type).build()); builder.withSelection(Events._ID + " = '" + raw_id + "'", null); } else {/* w w w .ja v a 2 s . c o m*/ builder = ContentProviderOperation.newInsert(Events.CONTENT_URI.buildUpon() .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type).build()); } long dtstart = event.getStartDate().getTime(); long dtend = dtstart + (1000 * 60 * 60); if (event.getEndDate() != null) dtend = event.getEndDate().getTime(); builder.withValue(Events.CALENDAR_ID, calendar_id); builder.withValue(Events.DTSTART, dtstart); builder.withValue(Events.DTEND, dtend); builder.withValue(Events.TITLE, event.getTitle()); String location = "Pizza Hut"; builder.withValue(Events.EVENT_LOCATION, location); String description = event.getDescription(); builder.withValue(Events.DESCRIPTION, description); builder.withValue(Events._SYNC_ID, Long.valueOf(event.getId())); return builder.build(); }
From source file:at.bitfire.davdroid.resource.LocalCollection.java
/** Appends account type, name and CALLER_IS_SYNCADAPTER to an Uri. */ protected Uri syncAdapterURI(Uri baseURI) { return baseURI.buildUpon().appendQueryParameter(entryColumnAccountType(), account.type) .appendQueryParameter(entryColumnAccountName(), account.name) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").build(); }
From source file:at.bitfire.davdroid.mirakel.resource.LocalCalendar.java
protected static Uri calendarsURI(Account account) { return Calendars.CONTENT_URI.buildUpon().appendQueryParameter(Calendars.ACCOUNT_NAME, account.name) .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type) .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").build(); }
From source file:com.chen.emailsync.SyncManager.java
public static Uri asSyncAdapter(Uri uri, String account, String accountType) { return uri.buildUpon().appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(Calendars.ACCOUNT_NAME, account) .appendQueryParameter(Calendars.ACCOUNT_TYPE, accountType).build(); }