app/src/main/java/org/andstatus/app/account/AccountUtils.java
/** Add this account to the Account Manager Without userdata yet */
Add this account to the Account Manager Without userdata yet
Add this account to the Account Manager Without userdata yet
public static Try<Account> addEmptyAccount(AccountManager am, String accountName, String password) {
        return Try.of( () -> {
            Account androidAccount = new Account(accountName, AuthenticatorService.ANDROID_ACCOUNT_TYPE);
            if (am.addAccountExplicitly(androidAccount, password, null)) {
                MyLog.v(AccountUtils.class, () -> "Persisted " + accountName);
                return androidAccount;
            } else {
                String errorMessage = "Account was not added to AccountManager: " + androidAccount;
                MyLog.e(AccountUtils.class, errorMessage);
                throw new Exception(errorMessage);
            }
        });
    }
public static Try < Account > addEmptyAccount ( AccountManager am , String accountName , String password ) { return Try . of ( ( ) -> { Account androidAccount = new Account ( accountName , AuthenticatorService . ANDROID_ACCOUNT_TYPE ) ; if ( am . addAccountExplicitly ( androidAccount , password , null ) ) { MyLog . v ( AccountUtils . class , ( ) -> "Persisted " + accountName ) ; return androidAccount ; } else { String errorMessage = "Account was not added to AccountManager: " + androidAccount ; MyLog . e ( AccountUtils . class , errorMessage ) ; throw new Exception ( errorMessage ) ; } } ) ; }
Add this account to the Account Manager Without userdata yet
Add this account to the Account Manager Without userdata yet
// Without SyncAdapter we got the error: // SyncManager(865): can't find a sync adapter for SyncAdapterType Key // {name=org.andstatus.app.data.MyProvider, type=org.andstatus.app}, // removing settings for it