public void init() throws JSONException { regLifecycle(); JSONObject json = getJsonData(); Bundle md = getMetaData(); long appKey = Long.valueOf(json.optString(APPKEY, md.getString(APPKEY)).replace("wdj.", "")); String secretKey = json.optString(APPSECRET, md.getString(APPSECRET)); wandouGamesApi = new WandouGamesApi.Builder(getActivity(), appKey, secretKey).create(); wandouGamesApi.setLogEnabled(true); wandouGamesApi.init(getActivity()); dispatchData(EVENT_INIT); wandouGamesApi.addWandouAccountListener( new WandouAccountListener() { @Override public void onLogoutSuccess() { dispatchData(EVENT_LOGOUT); } @Override public void onLoginSuccess() { // JSONObject data = new JSONObject(); // WandouPlayer uInfo = wandouGamesApi.getCurrentPlayerInfo(); // try { // data.put(TOKEN, wandouGamesApi.getToken(600)); // data.put(UID, uInfo.getId()); // } catch (JSONException e) { // e.printStackTrace(); // } // dispatchData(EVENT_LOGIN, data); } @Override public void onLoginFailed(int code, String msg) { dispatchError(EVENT_LOGIN, msg + "[" + code + "]"); } }); }