public static Intent createProxyAuthIntent(Context context, String applicationId, Collection<String> permissions, String e2e, boolean isRerequest, boolean isForPublish, DefaultAudience defaultAudience) { for (NativeAppInfo appInfo : facebookAppInfoList) { Intent intent = new Intent().setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY).putExtra("client_id", applicationId); if (!Utility.isNullOrEmpty(permissions)) { intent.putExtra("scope", TextUtils.join(",", permissions)); } if (!Utility.isNullOrEmpty(e2e)) { intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e); } intent.putExtra("response_type", "token,signed_request"); intent.putExtra("return_scopes", "true"); if (isForPublish) { intent.putExtra("default_audience", defaultAudience.getNativeProtocolAudience()); } intent.putExtra("legacy_override", "v2.5"); if (isRerequest) { intent.putExtra("auth_type", "rerequest"); } intent = validateActivityIntent(context, intent, appInfo); if (intent != null) { return intent; } } return null; }
@Override public void onCreate() { super.onCreate(); // initialize facebook configuration PermissionHelper[] permissions = new PermissionHelper[]{ PermissionHelper.USER_ABOUT_ME, PermissionHelper.EMAIL, PermissionHelper.USER_PHOTOS, PermissionHelper.USER_EVENTS, PermissionHelper.USER_ACTIONS_MUSIC, PermissionHelper.USER_FRIENDS, PermissionHelper.USER_GAMES_ACTIVITY, PermissionHelper.USER_BIRTHDAY, PermissionHelper.USER_TAGGED_PLACES, PermissionHelper.USER_MANAGED_GROUPS, PermissionHelper.PUBLISH_ACTION}; SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder() .setAppId(String.valueOf(R.string.facebook_app_id)) .setPermissions(permissions) .setDefaultAudience(DefaultAudience.FRIENDS) .setAskForAllPermissionsAtOnce(false) .build(); // init lib ReactiveFB.sdkInitialize(this); ReactiveFB.setConfiguration(configuration); }
public void setDefaultAudience(DefaultAudience defaultAudience) { this.defaultAudience = defaultAudience; }
public DefaultAudience getDefaultAudience() { return defaultAudience; }
public static Intent createProxyAuthIntent( Context context, String applicationId, Collection<String> permissions, String e2e, boolean isRerequest, boolean isForPublish, DefaultAudience defaultAudience) { for (NativeAppInfo appInfo : facebookAppInfoList) { Intent intent = new Intent() .setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY) .putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId); if (!Utility.isNullOrEmpty(permissions)) { intent.putExtra( FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions)); } if (!Utility.isNullOrEmpty(e2e)) { intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e); } intent.putExtra( ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE, ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST); intent.putExtra( ServerProtocol.DIALOG_PARAM_RETURN_SCOPES, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE); if (isForPublish) { intent.putExtra( ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, defaultAudience.getNativeProtocolAudience()); } // Override the API Version for Auth intent.putExtra( ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE, ServerProtocol.GRAPH_API_VERSION); // Set the re-request auth type for requests if (isRerequest) { intent.putExtra( ServerProtocol.DIALOG_PARAM_AUTH_TYPE, ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE); } intent = validateActivityIntent(context, intent, appInfo); if (intent != null) { return intent; } } return null; }
/** * @param defaultAudience * The defaultAudience to set. */ public Builder setDefaultAudience(DefaultAudience defaultAudience) { mDefaultAudience = defaultAudience; return this; }
public static Intent createProxyAuthIntent( Context context, String applicationId, Collection<String> permissions, String e2e, boolean isRerequest, DefaultAudience defaultAudience) { for (NativeAppInfo appInfo : facebookAppInfoList) { Intent intent = new Intent() .setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY) .putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId); if (!Utility.isNullOrEmpty(permissions)) { intent.putExtra( FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions)); } if (!Utility.isNullOrEmpty(e2e)) { intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e); } intent.putExtra( ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE, ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST); intent.putExtra( ServerProtocol.DIALOG_PARAM_RETURN_SCOPES, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE); intent.putExtra( ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, defaultAudience.getNativeProtocolAudience()); // Override the API Version for Auth intent.putExtra( ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE, ServerProtocol.GRAPH_API_VERSION); // Set the re-request auth type for requests if (isRerequest) { intent.putExtra( ServerProtocol.DIALOG_PARAM_AUTH_TYPE, ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE); } intent = validateActivityIntent(context, intent, appInfo); if (intent != null) { return intent; } } return null; }
/** * Sets the default audience to use when the user logs in. * This value is only useful when specifying publish permissions for the native * login dialog. * * @param defaultAudience the default audience value to use */ public void setDefaultAudience(DefaultAudience defaultAudience) { properties.setDefaultAudience(defaultAudience); }
/** * Gets the default audience to use when the user logs in. * This value is only useful when specifying publish permissions for the native * login dialog. * * @return the default audience value to use */ public DefaultAudience getDefaultAudience() { return properties.getDefaultAudience(); }
/** * Get session default audience * * @return */ DefaultAudience getDefaultAudience() { return mDefaultAudience; }