I am trying to write an application that synchronizes my mail and my calendar with just one click. After looking through this forum, I found some useful tips and wrote a short test application that takes my first google account and starts synchronization.
The code is still working, but only contacts are being synced now!
AccountManager am = AccountManager.get(this);
Account[] acc = am.getAccountsByType("com.google");
Account account = null;
if (acc.length > 0) {
account = acc[0];
Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
ContentResolver.requestSync(account, ContactsContract.AUTHORITY,
extras);
}
requestSync "" , "ContactsContract.AUTHORITY", , .
: - , , ?
"null" , (, )
public static void requestSync (Account account, String authority, Bundle extras)
!