@Override public void registerCallback(final ApiMethodCallback callback, final boolean requiresModel) throws RemoteException { if (DEBUG) { Log.d(TAG, "Register API callback " + callback); } final APICallInfoData b = new APICallInfoData(); b.set(lastOperation); if (b.hasData()) { if (DEBUG) { Log.d(TAG, "Report last operation " + b.operation); } callback.reportLastOperation(b.token, b.operation, b.responseData); } b.set(pending); if (b.hasData()) { callback.reportPending(b.token, b.operation); } apiCallbacks.register(callback, requiresModel); }
private void loadLastOperation() { final SharedPreferences src = lastOperationDump; final APICallInfoData dst = lastOperation; dst.set(src.getInt("op", Operation.NOP), src.getInt("token", -1)); final ResponseData responseData = new ResponseData(); responseData.setMessage(src.getString("msg", null)); responseData.setErrorCode(src.getInt("errorCode", ResponseData.RESPONSE_CODE_ILLEGAL)); final String url = src.getString("data", null); responseData.setData(url != null ? Uri.parse(url) : null); dst.set(responseData); if (DEBUG) { Log.d( TAG, "Loaded last operation: " + dst.operation + " / " + dst.responseData.getErrorCode() + " -> " + dst.hasData()); } }