@UnityCallable
  public static void LogAppEvent(String params_str) {
    Log.v(TAG, "LogAppEvent(" + params_str + ")");
    UnityParams unity_params = UnityParams.parse(params_str);

    Bundle parameters = new Bundle();
    if (unity_params.has("parameters")) {
      UnityParams unity_params_parameter = unity_params.getParamsObject("parameters");
      parameters = unity_params_parameter.getStringParams();
    }

    if (unity_params.has("logPurchase")) {
      FB.getAppEventsLogger()
          .logPurchase(
              new BigDecimal(unity_params.getDouble("logPurchase")),
              Currency.getInstance(unity_params.getString("currency")),
              parameters);
    } else if (unity_params.hasString("logEvent")) {
      if (unity_params.has("valueToSum")) {
        FB.getAppEventsLogger()
            .logEvent(
                unity_params.getString("logEvent"),
                unity_params.getDouble("valueToSum"),
                parameters);
      } else {
        FB.getAppEventsLogger().logEvent(unity_params.getString("logEvent"), parameters);
      }
    } else {
      Log.e(TAG, "couldn't logPurchase or logEvent params: " + params_str);
    }
  }