@Override
  public void onUserAction(
      com.sessionm.api.SessionM instance, UserAction action, Map<String, String> data) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
      Log.d(TAG, this + ".onUserAction(): " + action.getCode() + ", data: " + data);
    }

    JSONObject jsonObject = new JSONObject();
    try {
      jsonObject.put("userAction", action.getCode());
      if (data != null) {
        JSONObject dataObject = new JSONObject();
        for (Map.Entry<String, String> entry : data.entrySet()) {
          dataObject.put(entry.getKey(), entry.getValue());
        }
        jsonObject.put("data", dataObject);
      }
    } catch (JSONException e) {
      if (Log.isLoggable(TAG, Log.DEBUG)) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
          Log.d(TAG, "JSONException when trying to get userAction: " + e);
        }
      }
    }
    if (callbackGameObjectName != null) {
      UnityPlayer.UnitySendMessage(
          callbackGameObjectName, "_sessionM_HandleUserActionMessage", jsonObject.toString());
    }
  }