コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account)
     throws NetworkErrorException {
   // Remove the data from the application behind the scenes
   final String username = LoginPreferences.getUsername();
   if (!TextUtils.isEmpty(username)) {
     mApplication.removeUserData();
   }
   Bundle result = new Bundle();
   /*
    * At this point the user was already prompted by the system for confirmation
    * Returning false here would just popup another notification
    * saying its not possible to remove the Account without factory resetting
    */
   result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
   return result;
 }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public Bundle addAccount(
      AccountAuthenticatorResponse response,
      String accountType,
      String authTokenType,
      String[] requiredFeatures,
      Bundle options) {
    final Intent intent = new Intent();
    // In order to not use the UI package we define the class as a String
    // FIXME: Change this not to depend on the hardcoded String. Maybe use intent filter on
    // StartActivity
    intent.setClassName(mApplication.getApplicationContext(), "com.tesla.people.ui.StartActivity");
    if (NativeContactsApi.getInstance().isPeopleAccountCreated()) {
      intent.setAction(ACTION_ONE_ACCOUNT_ONLY_INTENT);
    }

    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
  }