本文整理汇总了Java中com.facebook.Request.setParameters方法的典型用法代码示例。如果您正苦于以下问题:Java Request.setParameters方法的具体用法?Java Request.setParameters怎么用?Java Request.setParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Request
的用法示例。
在下文中一共展示了Request.setParameters方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fetchUserInfo
import com.facebook.Request; //导入方法依赖的package包/类
private void fetchUserInfo() {
final Session currentSession = getSession();
if (currentSession != null && currentSession.isOpened()) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == getSession()) {
user = me;
updateUI();
}
if (response.getError() != null) {
loginButton.handleError(response.getError().getException());
}
}
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
}
}
示例4: 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;
}
示例5: 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;
}
示例6: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(Location location, int radiusInMeters, int resultsLimit, String searchText,
Set<String> extraFields,
Session session) {
Request request = Request.newPlacesSearchRequest(session, location, radiusInMeters, resultsLimit, searchText,
null);
Set<String> fields = new HashSet<String>(extraFields);
String[] requiredFields = new String[]{
ID,
NAME,
LOCATION,
CATEGORY,
WERE_HERE_COUNT
};
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;
}
示例7: 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;
}
示例8: getUser
import com.facebook.Request; //导入方法依赖的package包/类
@Override
public void getUser(final Callback<SocialMember> callback) {
if (notifyIfNotLoggedIn(callback)) {
return;
}
//If the profile for the current user has already been fetched use the cached result.
if (userProfile != null) {
callback.onSuccess(userProfile);
return;
}
Session session = Session.getActiveSession();
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (!notifyIfError(response, callback)) {
logger.debug(user.getUsername() + ":" + user.getName() + ":" + user.getFirstName()
+ ":" + user.getLastName() + ":" + user.getId());
logger.debug(user.getProperty("email") + "");
SocialMember member = new SocialMember(Long.parseLong(user.getId()), user.getName());
member.setEmail(user.getProperty("email") + "");
callback.onSuccess(member);
}
}
});
Bundle params = request.getParameters();
params.putString("fields", "email,id,name");
request.setParameters(params);
request.executeAsync();
}
示例9: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(String paramString, Set<String> paramSet, Session paramSession)
{
Request localRequest = Request.newGraphPathRequest(paramSession, paramString + "/friends", null);
HashSet localHashSet = new HashSet(paramSet);
localHashSet.addAll(Arrays.asList(new String[] { "id", "name" }));
String str = this.adapter.getPictureFieldSpecifier();
if (str != null)
localHashSet.add(str);
Bundle localBundle = localRequest.getParameters();
localBundle.putString("fields", TextUtils.join(",", localHashSet));
localRequest.setParameters(localBundle);
return localRequest;
}
示例10: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(Session session) {
Request request = Request.newGraphPathRequest(session, "me/friends", null);
Set<String> fields = new HashSet<String>();
String[] requiredFields = new String[] { "id", "name", "picture" };
fields.addAll(Arrays.asList(requiredFields));
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
示例11: queryAppAttributionSupportAndWait
import com.facebook.Request; //导入方法依赖的package包/类
public static boolean queryAppAttributionSupportAndWait(final String applicationId) {
synchronized (LOCK) {
// Cache the last app checked results.
if (applicationId.equals(lastAppCheckedForAttributionStatus)) {
return attributionAllowedForLastAppChecked;
}
Bundle supportsAttributionParams = new Bundle();
supportsAttributionParams.putString(APPLICATION_FIELDS, SUPPORTS_ATTRIBUTION);
Request pingRequest = Request.newGraphPathRequest(null, applicationId, null);
pingRequest.setParameters(supportsAttributionParams);
GraphObject supportResponse = pingRequest.executeAndWait().getGraphObject();
Object doesSupportAttribution = false;
if (supportResponse != null) {
doesSupportAttribution = supportResponse.getProperty(SUPPORTS_ATTRIBUTION);
}
if (!(doesSupportAttribution instanceof Boolean)) {
// Should never happen, but be safe in case server returns non-Boolean
doesSupportAttribution = false;
}
lastAppCheckedForAttributionStatus = applicationId;
attributionAllowedForLastAppChecked = ((Boolean)doesSupportAttribution == true);
return attributionAllowedForLastAppChecked;
}
}
示例12: 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();
}