public void verifyExistentAccount() { SharedPreferences prefs = getSharedPreferences(TwAPImeApplication.PREFS_NAME, MODE_PRIVATE); // if (prefs.getString(AuthActivity.PREFS_KEY_TOKEN, null) == null) { startActivity(new Intent(this, AuthActivity.class)); } else { Token token = new Token( prefs.getString(AuthActivity.PREFS_KEY_TOKEN, null), prefs.getString(AuthActivity.PREFS_KEY_TOKEN_SECRET, null)); // Credential c = new Credential( prefs.getString(AuthActivity.PREFS_KEY_USERNAME, null), AuthActivity.CONSUMER_KEY, AuthActivity.CONSUMER_SECRET, token); // UserAccountManager uam = UserAccountManager.getInstance(c); // try { if (uam.verifyCredential()) { TwAPImeApplication app = (TwAPImeApplication) getApplication(); app.setUserAccountManager(uam); // startActivity(new Intent(this, HomeActivity.class)); } else { startActivity(new Intent(this, AuthActivity.class)); } } catch (Exception e) { startActivity(new Intent(this, AuthActivity.class)); } } }
/** @see com.twapime.app.util.AsyncServiceCall#run(P[]) */ @Override protected List<UserAccount> run(UserAccount... params) throws IOException, LimitExceededException { TwAPImeApplication app = (TwAPImeApplication) getContext().getApplicationContext(); UserAccountManager uam = app.getUserAccountManager(); List<UserAccount> result = new ArrayList<UserAccount>(); // for (UserAccount user : params) { result.add(uam.updateProfile(user)); } // return result; }