本文整理匯總了Java中com.facebook.HttpMethod.GET屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpMethod.GET屬性的具體用法?Java HttpMethod.GET怎麽用?Java HttpMethod.GET使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.facebook.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.GET屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
protected void execute() {
if (sessionManager.isLoggedIn()) {
AccessToken accessToken = sessionManager.getAccessToken();
Bundle bundle = updateAppSecretProof();
GraphRequest request = new GraphRequest(accessToken, getGraphPath(),
bundle, HttpMethod.GET);
request.setVersion(configuration.getGraphVersion());
runRequest(request);
} else {
String reason = Errors.getError(Errors.ErrorMsg.LOGIN);
Logger.logError(getClass(), reason, null);
if (mSingleEmitter != null) {
mSingleEmitter.onError(new FacebookAuthorizationException(reason));
}
}
}
示例2: requestFacebookCoverPhoto
public void requestFacebookCoverPhoto(AccessToken accessToken, final FacebookGetLoginUserCallback callback) {
if (NetworkUtils.getInstance().isOnline()) {
Bundle params = new Bundle();
params.putString("fields", "cover");
GraphRequest request = new GraphRequest(
accessToken,
"me",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
try {
JSONObject coverResponse = response.getJSONObject().getJSONObject("cover");
String coverUrl = coverResponse.getString("source");
UserModel.getInstance().addFacebookCoverUrl(coverUrl);
callback.onSuccess();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
);
request.executeAsync();
}
}
示例3: requestFacebookProfilePhoto
public void requestFacebookProfilePhoto(AccessToken accessToken, final FacebookGetLoginUserCallback callback) {
if (NetworkUtils.getInstance().isOnline()) {
Bundle params = new Bundle();
params.putString("redirect", "false");
params.putString("type", "large");
GraphRequest request = new GraphRequest(
accessToken,
"me/picture",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
try {
String profilePhotoUrl = response.getJSONObject().getJSONObject("data").getString("url");
UserModel.getInstance().addFacebookProfileUrl(profilePhotoUrl);
callback.onSuccess();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
);
request.executeAsync();
}
}
示例4: requestAccounts
/**
* Asynchronously requests the Page accounts associated with the linked account. Requires an opened active {@link Session}.
*
* @param callback a {@link Callback} when the request completes.
* @return true if the request is made; false if no opened {@link Session} is active.
*/
boolean requestAccounts(Callback callback) {
boolean isSuccessful = false;
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// Construct fields to request.
Bundle params = new Bundle();
params.putString(ACCOUNTS_LISTING_FEILDS_KEY, ACCOUNTS_LISTING_FIELDS_VALUE);
// Construct and execute albums listing request.
Request request = new Request(session, ACCOUNTS_LISTING_GRAPH_PATH, params, HttpMethod.GET, callback);
request.executeAsync();
isSuccessful = true;
}
return isSuccessful;
}
示例5: requestAlbums
/**
* Asynchronously requests the albums associated with the linked account. Requires an opened active {@link Session}.
*
* @param id may be {@link #ME} or a Page id.
* @param callback a {@link Callback} when the request completes.
* @return true if the request is made; false if no opened {@link Session} is active.
*/
boolean requestAlbums(String id, Callback callback) {
boolean isSuccessful = false;
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// Construct fields to request.
Bundle params = new Bundle();
params.putString(ALBUMS_LISTING_LIMIT_KEY, ALBUMS_LISTING_LIMIT_VALUE);
params.putString(ALBUMS_LISTING_FEILDS_KEY, ALBUMS_LISTING_FIELDS_VALUE);
// Construct and execute albums listing request.
Request request = new Request(session, id + TO_ALBUMS_LISTING_GRAPH_PATH, params, HttpMethod.GET, callback);
request.executeAsync();
isSuccessful = true;
}
return isSuccessful;
}
示例6: getGraphMeRequestWithCache
private static GraphRequest getGraphMeRequestWithCache(
final String accessToken) {
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,first_name,middle_name,last_name,link");
parameters.putString("access_token", accessToken);
GraphRequest graphRequest = new GraphRequest(
null,
"me",
parameters,
HttpMethod.GET,
null);
return graphRequest;
}
示例7: getFeedGraphRequest
public static GraphRequest getFeedGraphRequest(String pageId, GraphRequest.Callback callback) {
return new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + pageId + "/feed?include_hidden=true&fields=message,created_time,is_hidden,insights.metric(post_impressions)",
null,
HttpMethod.GET,
callback
);
}
示例8: getPromotablePostsGraphRequest
public static GraphRequest getPromotablePostsGraphRequest(String pageId, GraphRequest.Callback callback) {
return new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + pageId + "/promotable_posts?is_published=false&include_hidden=true&fields=message,created_time,is_hidden,insights.metric(post_impressions)",
null,
HttpMethod.GET,
callback
);
}
示例9: getMeAccoountsGraphRequest
public static GraphRequest getMeAccoountsGraphRequest(GraphRequest.Callback callback) {
return new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/accounts",
null,
HttpMethod.GET,
callback
);
}
示例10: getLike
/**
* 取得讚
*
* @param object_id
* @param callback
*/
public void getLike(String object_id, Callback callback) {
GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(),
"/" + object_id + "/likes",
null,
HttpMethod.GET,
DefaultCallback(callback));
graphRequest.executeAsync();
}
示例11: getComments
/**
* @param post_id
* @param bundle
* @param callback
*/
public void getComments(String post_id, Bundle bundle, Callback callback) {
if (bundle == null) {
bundle = new Bundle();
}
GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(),
"/" + post_id + "/comments",
bundle,
HttpMethod.GET,
DefaultCallback(callback));
graphRequest.executeAsync();
}
示例12: getFeed
public void getFeed(String id, Bundle bundle, Callback callback) {
GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(),
"/" + id + "/feed",
bundle,
HttpMethod.GET,
DefaultCallback(callback));
graphRequest.executeAsync();
}
示例13: getPost
public void getPost(String id,Bundle bundle, Callback callback) {
GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(),
"/" + id,
bundle,
HttpMethod.GET,
DefaultCallback(callback));
graphRequest.executeAsync();
}
示例14: getCredentials
void getCredentials(final CredentialsListener listener) {
Log.d(TAG, "getUserData");
final AccessToken currentToken = AccessToken.getCurrentAccessToken();
GraphRequest request = new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
try {
Profile profile = Profile.getCurrentProfile();
String email = response.getJSONObject().getString("email");
String name = response.getJSONObject().getString("name");
String imageUri = profile.getProfilePictureUri(200,200).toString();
SocialMediaCredentials credentials =
new SocialMediaCredentials(currentToken.getToken(),
currentToken.getUserId(), FACEBOOK_ACCOUNT, name, email,
imageUri);
listener.onSuccess(new FacebookAccount(credentials));
} catch (JSONException|NullPointerException e) {
listener.onError(new ServerStatusCode(ServerStatusCode.LOGIN_API_ERROR));
Log.e(TAG, e.getMessage()==null?"null message":e.getMessage());
}
}
}
);
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email");
request.setParameters(parameters);
request.executeAsync();
}
示例15: onExecute
@Override
public void onExecute()
{
// If we already have a next page request ready - execute it now. Otherwise
// start a brand new request.
PhotosGraphRequestCallback photosGraphRequestCallback = new PhotosGraphRequestCallback( mCallback );
if ( mNextPhotosPageGraphRequest != null )
{
mNextPhotosPageGraphRequest.setCallback( photosGraphRequestCallback );
mNextPhotosPageGraphRequest.executeAsync();
mNextPhotosPageGraphRequest = null;
return;
}
Bundle parameters = new Bundle();
parameters.putString( PARAMETER_NAME_TYPE, PARAMETER_VALUE_TYPE );
parameters.putString( PARAMETER_NAME_FIELDS, PARAMETER_VALUE_FIELDS );
GraphRequest request = new GraphRequest(
AccessToken.getCurrentAccessToken(),
GRAPH_PATH_MY_PHOTOS,
parameters,
HttpMethod.GET,
photosGraphRequestCallback );
request.executeAsync();
}