public static boolean restore(FacebookModule fbmod, Context context) { SharedPreferences savedSession = context.getSharedPreferences(KEY, Context.MODE_PRIVATE); fbmod.facebook.setAccessToken(savedSession.getString(TOKEN, null)); fbmod.facebook.setAccessExpires(savedSession.getLong(EXPIRES, 0)); fbmod.uid = savedSession.getString(UID, null); fbmod.setAppid(savedSession.getString(APPID, null)); return fbmod.facebook.isSessionValid(); }
public static boolean save(FacebookModule fbmod, Context context) { Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit(); editor.putString(TOKEN, fbmod.facebook.getAccessToken()); editor.putLong(EXPIRES, fbmod.facebook.getAccessExpires()); editor.putString(UID, fbmod.uid); editor.putString(APPID, fbmod.getAppid()); return editor.commit(); }