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); } }
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(); } }
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; }