本文整理汇总了Java中com.facebook.Request.newGraphPathRequest方法的典型用法代码示例。如果您正苦于以下问题:Java Request.newGraphPathRequest方法的具体用法?Java Request.newGraphPathRequest怎么用?Java Request.newGraphPathRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Request
的用法示例。
在下文中一共展示了Request.newGraphPathRequest方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(String userID, Set<String> extraFields, Session session) {
Request request = Request.newGraphPathRequest(session, userID + "/friends", null);
Set<String> fields = new HashSet<String>(extraFields);
String[] requiredFields = new String[]{
ID,
NAME
};
fields.addAll(Arrays.asList(requiredFields));
String pictureField = adapter.getPictureFieldSpecifier();
if (pictureField != null) {
fields.add(pictureField);
}
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
示例2: queryAppSettings
import com.facebook.Request; //导入方法依赖的package包/类
public static FetchedAppSettings queryAppSettings(final String applicationId, final boolean forceRequery) {
// Cache the last app checked results.
if (!forceRequery && fetchedAppSettings.containsKey(applicationId)) {
return fetchedAppSettings.get(applicationId);
}
Bundle appSettingsParams = new Bundle();
appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));
Request request = Request.newGraphPathRequest(null, applicationId, null);
request.setParameters(appSettingsParams);
GraphObject supportResponse = request.executeAndWait().getGraphObject();
FetchedAppSettings result = new FetchedAppSettings(
safeGetBooleanFromResponse(supportResponse, SUPPORTS_ATTRIBUTION),
safeGetBooleanFromResponse(supportResponse, SUPPORTS_IMPLICIT_SDK_LOGGING));
fetchedAppSettings.put(applicationId, result);
return result;
}
示例3: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(String userID, Set<String> extraFields, Session session) {
Request request = Request.newGraphPathRequest(session, userID + friendPickerType.getRequestPath(), null);
Set<String> fields = new HashSet<String>(extraFields);
String[] requiredFields = new String[]{
ID,
NAME
};
fields.addAll(Arrays.asList(requiredFields));
String pictureField = adapter.getPictureFieldSpecifier();
if (pictureField != null) {
fields.add(pictureField);
}
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
示例4: queryAppSettings
import com.facebook.Request; //导入方法依赖的package包/类
public static FetchedAppSettings queryAppSettings(final String applicationId, final boolean forceRequery) {
// Cache the last app checked results.
if (!forceRequery && fetchedAppSettings.containsKey(applicationId)) {
return fetchedAppSettings.get(applicationId);
}
Bundle appSettingsParams = new Bundle();
appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));
Request request = Request.newGraphPathRequest(null, applicationId, null);
request.setParameters(appSettingsParams);
GraphObject supportResponse = request.executeAndWait().getGraphObject();
FetchedAppSettings result = new FetchedAppSettings(
safeGetBooleanFromResponse(supportResponse, SUPPORTS_ATTRIBUTION),
safeGetBooleanFromResponse(supportResponse, SUPPORTS_IMPLICIT_SDK_LOGGING),
safeGetStringFromResponse(supportResponse, NUX_CONTENT),
safeGetBooleanFromResponse(supportResponse, NUX_ENABLED)
);
fetchedAppSettings.put(applicationId, result);
return result;
}
示例5: getAppSettingsQueryResponse
import com.facebook.Request; //导入方法依赖的package包/类
private static GraphObject getAppSettingsQueryResponse(String applicationId) {
Bundle appSettingsParams = new Bundle();
appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));
Request request = Request.newGraphPathRequest(null, applicationId, null);
request.setSkipClientToken(true);
request.setParameters(appSettingsParams);
GraphObject response = request.executeAndWait().getGraphObject();
return response;
}
示例6: requestAsync
import com.facebook.Request; //导入方法依赖的package包/类
/**
* Request to login async.
*
* @param strPath
* - Path of login.
* @param callback
* - Call back function.
*/
public <T> void requestAsync( String strPath,
final OnResult<T> callback)
{
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Settings.addLoggingBehavior(LoggingBehavior.REQUESTS);
Session session = Session.getActiveSession();
Request request =
Request.newGraphPathRequest(session, strPath,
new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
if (response.getError() != null)
{
Log.i("MainActivity",
String.format(
"Error making request: %s",
response.getError()));
}
else
{
GraphUser user =
response.getGraphObjectAs(GraphUser.class);
callback.onResult((T) user);
Log.i("MainActivity",
String.format(
"Name: %s",
user.getName()));
}
}
});
request.executeAsync();
}
示例7: queryAppSettings
import com.facebook.Request; //导入方法依赖的package包/类
public static FetchedAppSettings queryAppSettings(String paramString, boolean paramBoolean)
{
if ((!paramBoolean) && (fetchedAppSettings.containsKey(paramString)))
return (FetchedAppSettings)fetchedAppSettings.get(paramString);
Bundle localBundle = new Bundle();
localBundle.putString("fields", TextUtils.join(",", APP_SETTING_FIELDS));
Request localRequest = Request.newGraphPathRequest(null, paramString, null);
localRequest.setParameters(localBundle);
GraphObject localGraphObject = localRequest.executeAndWait().getGraphObject();
FetchedAppSettings localFetchedAppSettings = new FetchedAppSettings(safeGetBooleanFromResponse(localGraphObject, "supports_attribution"), safeGetBooleanFromResponse(localGraphObject, "supports_implicit_sdk_logging"), safeGetStringFromResponse(localGraphObject, "gdpv4_nux_content"), safeGetBooleanFromResponse(localGraphObject, "gdpv4_nux_enabled"), null);
fetchedAppSettings.put(paramString, localFetchedAppSettings);
return localFetchedAppSettings;
}
示例8: getInvitableFriendsList
import com.facebook.Request; //导入方法依赖的package包/类
/** Does not work if your app dosent have facebook game app privileges.*/
public static Promise<List<JSONObject>, BError, Void> getInvitableFriendsList(){
final Deferred<List<JSONObject>, BError, Void> deferred = new DeferredObject<>();
final Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// Get a list of friends who have _not installed_ the game.
Request invitableFriendsRequest = Request.newGraphPathRequest(session,
"/me/invitable_friends", new Request.Callback() {
@Override
public void onCompleted(Response response) {
FacebookRequestError error = response.getError();
if (error != null) {
if (DEBUG) Timber.e(error.toString());
deferred.reject(new BError(BError.Code.TAGGED, "Error while fetching invitable friends.", error));
} else if (session == Session.getActiveSession()) {
if (response != null) {
// Get the result
GraphObject graphObject = response.getGraphObject();
JSONArray dataArray = (JSONArray)graphObject.getProperty("data");
List<JSONObject> invitableFriends = new ArrayList<JSONObject>();
if (dataArray.length() > 0) {
// Ensure the user has at least one friend ...
for (int i=0; i<dataArray.length(); i++) {
invitableFriends.add(dataArray.optJSONObject(i));
}
}
deferred.resolve(invitableFriends);
}
}
}
});
Bundle invitableParams = new Bundle();
invitableParams.putString("fields", "id,first_name,picture");
invitableFriendsRequest.setParameters(invitableParams);
invitableFriendsRequest.executeAsync();
}
else
{
if (DEBUG) Timber.d("Session is closed");
deferred.reject(new BError(BError.Code.SESSION_CLOSED));
}
return deferred.promise();
}
示例9: getPlaceFromReference
import com.facebook.Request; //导入方法依赖的package包/类
@Override
public RawPlace getPlaceFromReference(String id) {
final Session session = Session.getActiveSession();
if (session != null & session.isOpened()) {
// Make an API call to get nearby places and define a new callback to handle the response
Request request = Request.newGraphPathRequest(session, id, new Callback() {
@Override
public void onCompleted(Response response) {
}
});
GraphPlace graphPlace = request.executeAndWait().getGraphObject().cast(GraphPlace.class);
return createPlace(graphPlace);
}
return null;
}