コード例 #1
0
 protected void commitYukonAccountKeeperRegister() {
   try {
     new AndroidUtil(this)
         .writeToSharedPreferences(
             ACCOUNT_FILE, ACCOUNT_KEEPER_KEY, yukonAccountKeeper.toString());
   } catch (NullPointerException e) {
     new AndroidUtil(this).writeToSharedPreferences(ACCOUNT_FILE, ACCOUNT_KEEPER_KEY, null);
   }
 }
コード例 #2
0
 protected void onConnectOnce() {
   System.out.println(">> CONNECTED ONCE <<");
   try {
     System.out.println(credential.getSelectedAccountName());
     System.out.println(yukonAccountKeeper.toString());
     System.out.println(getYukonAccountKeeperRegister().toString());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #3
0
  protected void removeCredential() {
    AndroidUtil androidUtil = new AndroidUtil(this);

    try {
      YukonAccountKeeper yukonAccountKeeper =
          new YukonAccountKeeper(
              androidUtil.readFromSharedPreferences(ACCOUNT_FILE, ACCOUNT_KEEPER_KEY, null));
      yukonAccountKeeper.setMainAccount(null);
      androidUtil.writeToSharedPreferences(
          ACCOUNT_FILE, ACCOUNT_KEEPER_KEY, yukonAccountKeeper.toString());
    } catch (NullPointerException | JSONException e) {
      androidUtil.writeToSharedPreferences(ACCOUNT_FILE, ACCOUNT_KEEPER_KEY, null);
    }

    credential = null;
  }