public static Uri getProfilePictureUri( String userId, int width, int height) { Validate.notNullOrEmpty(userId, "userId"); width = Math.max(width, UNSPECIFIED_DIMENSION); height = Math.max(height, UNSPECIFIED_DIMENSION); if (width == UNSPECIFIED_DIMENSION && height == UNSPECIFIED_DIMENSION) { throw new IllegalArgumentException("Either width or height must be greater than 0"); } Uri.Builder builder = Uri.parse(ServerProtocol.getGraphUrlBase()) .buildUpon() .path(String.format( Locale.US, PATH, FacebookSdk.getGraphApiVersion(), userId)); if (height != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(HEIGHT_PARAM, String.valueOf(height)); } if (width != UNSPECIFIED_DIMENSION) { builder.appendQueryParameter(WIDTH_PARAM, String.valueOf(width)); } builder.appendQueryParameter(MIGRATION_PARAM, MIGRATION_VALUE); return builder.build(); }
public CustomTab(String action, Bundle parameters) { if (parameters == null) { parameters = new Bundle(); } uri = Utility.buildUri( ServerProtocol.getDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/" + ServerProtocol.DIALOG_PATH + action, parameters); }
final String getUrlForSingleRequest() { if (overriddenURL != null) { return overriddenURL.toString(); } String graphBaseUrlBase; if (this.getHttpMethod() == HttpMethod.POST && graphPath != null && graphPath.endsWith(VIDEOS_SUFFIX)) { graphBaseUrlBase = ServerProtocol.getGraphVideoUrlBase(); } else { graphBaseUrlBase = ServerProtocol.getGraphUrlBase(); } String baseUrl = String.format("%s/%s", graphBaseUrlBase, getGraphPathWithVersion()); addCommonParameters(); return appendParametersToBaseUrl(baseUrl, false); }
Bundle webParams = ServerProtocol.getQueryParamsForPlatformActivityIntentWebFallback( appCall.getCallId().toString(), protocolVersion, ServerProtocol.getDialogAuthority(), fallbackUrl.toString(), webParams);
/** * Constructor which will construct the URL of the Web dialog based on the specified parameters. * * @param context the context to use to display the dialog * @param action the portion of the dialog URL following "dialog/" * @param parameters parameters which will be included as part of the URL * @param theme identifier of a theme to pass to the Dialog class * @param listener the listener to notify, or null if no notification is desired */ public WebDialog(Context context, String action, Bundle parameters, int theme, OnCompleteListener listener) { super(context, theme); if (parameters == null) { parameters = new Bundle(); } // our webview client only handles the redirect uri we specify, so just hard code it here parameters.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, REDIRECT_URI); parameters.putString(ServerProtocol.DIALOG_PARAM_DISPLAY, DISPLAY_TOUCH); Uri uri = Utility.buildUri( ServerProtocol.getDialogAuthority(), ServerProtocol.getAPIVersion() + "/" + ServerProtocol.DIALOG_PATH + action, parameters); this.url = uri.toString(); onCompleteListener = listener; }
this.version = ServerProtocol.getAPIVersion();
final String getRelativeUrlForBatchedRequest() { if (overriddenURL != null) { throw new FacebookException("Can't override URL for a batch request"); } String baseUrl = String.format("%s/%s", ServerProtocol.getGraphUrlBase(), getGraphPathWithVersion()); addCommonParameters(); String fullUrl = appendParametersToBaseUrl(baseUrl, true); Uri uri = Uri.parse(fullUrl); return String.format("%s?%s", uri.getPath(), uri.getQuery()); }
final String getUrlForSingleRequest() { if (overriddenURL != null) { return overriddenURL.toString(); } String graphBaseUrlBase; if (this.getHttpMethod() == HttpMethod.POST && graphPath != null && graphPath.endsWith(VIDEOS_SUFFIX)) { graphBaseUrlBase = ServerProtocol.getGraphVideoUrlBase(); } else { graphBaseUrlBase = ServerProtocol.getGraphUrlBase(); } String baseUrl = String.format("%s/%s", graphBaseUrlBase, getGraphPathWithVersion()); addCommonParameters(); return appendParametersToBaseUrl(baseUrl); }
} else { Uri uri = Utility.buildUri( ServerProtocol.getDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/" + ServerProtocol.DIALOG_PATH + action, parameters);
url = new URL(ServerProtocol.getGraphUrlBase());
ServerProtocol.getDialogAuthority(), FacebookSdk.getGraphApiVersion() + "/" + ServerProtocol.DIALOG_PATH + action, parameters);
@Test public void testFacebookDomain() { FacebookSdk.setFacebookDomain("beta.facebook.com"); String graphUrlBase = ServerProtocol.getGraphUrlBase(); assertEquals("https://graph.beta.facebook.com", graphUrlBase); FacebookSdk.setFacebookDomain("facebook.com"); }
url = new URL(ServerProtocol.getGraphUrlBase());