/**
   * Create account if needed.
   *
   * @param context ContextΩ
   */
  public static boolean createSyncAccount(Context context) {
    boolean newAccount = false;
    boolean setupComplete =
        PreferenceManager.getDefaultSharedPreferences(context)
            .getBoolean(PREF_SETUP_COMPLETE, false);
    Account account = GenericAccountService.getAccount(ACCOUNT_TYPE);
    AccountManager accountManager =
        (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
    if (accountManager.addAccountExplicitly(account, null, null)) {
      ContentResolver.setIsSyncable(account, CONTENT_AUTHORITY, 1);
      ContentResolver.setSyncAutomatically(account, CONTENT_AUTHORITY, true);
      ContentResolver.addPeriodicSync(account, CONTENT_AUTHORITY, new Bundle(), SYNC_FREQUENCY);
      newAccount = true;
    }

    final boolean refresh = newAccount || !setupComplete;
    if (refresh) {
      refresh();
      PreferenceManager.getDefaultSharedPreferences(context)
          .edit()
          .putBoolean(PREF_SETUP_COMPLETE, true)
          .commit();
    }

    return refresh;
  }
 private static void triggerRefresh(Bundle b) {
   b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
   b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
   ContentResolver.requestSync(
       GenericAccountService.getAccount(ACCOUNT_TYPE), CONTENT_AUTHORITY, b);
 }