protected void showImpl()

in facebook-gamingservices/src/main/java/com/facebook/gamingservices/FriendFinderDialog.java [86:131]


  protected void showImpl() {
    AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
    if (currentAccessToken == null || currentAccessToken.isExpired()) {
      throw new FacebookException(
          "Attempted to open GamingServices FriendFinder" + " with an invalid access token");
    }

    String app_id = currentAccessToken.getApplicationId();
    boolean isRunningInCloud = CloudGameLoginHandler.isRunningInCloud();

    if (isRunningInCloud) {
      // When running on FB's servers we will just send a message to request the UI to show
      // on top of the game.
      Context context = this.getActivityContext();
      final DaemonRequest.Callback requestCallback =
          new DaemonRequest.Callback() {
            public void onCompleted(GraphResponse response) {
              if (mCallback != null) {
                if (response.getError() != null) {
                  mCallback.onError(new FacebookException(response.getError().getErrorMessage()));
                } else {
                  mCallback.onSuccess(new Result());
                }
              }
            }
          };

      JSONObject parameters = new JSONObject();
      try {
        parameters.put(SDKConstants.PARAM_DEEP_LINK_ID, app_id);
        parameters.put(SDKConstants.PARAM_DEEP_LINK, "FRIEND_FINDER");
        DaemonRequest.executeAsync(
            context, parameters, requestCallback, SDKMessageEnum.OPEN_GAMING_SERVICES_DEEP_LINK);
      } catch (JSONException e) {
        if (mCallback != null) {
          mCallback.onError(new FacebookException("Couldn't prepare Friend Finder Dialog"));
        }
      }
      return;
    }

    String dialog_uri = "https://fb.gg/me/friendfinder/" + app_id;

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(dialog_uri));
    startActivityForResult(intent, getRequestCode());
  }