本文整理汇总了Java中com.facebook.Request.executeBatchAsync方法的典型用法代码示例。如果您正苦于以下问题:Java Request.executeBatchAsync方法的具体用法?Java Request.executeBatchAsync怎么用?Java Request.executeBatchAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Request
的用法示例。
在下文中一共展示了Request.executeBatchAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: followNextLink
import com.facebook.Request; //导入方法依赖的package包/类
public void followNextLink() {
if (nextRequest != null) {
appendResults = true;
currentRequest = nextRequest;
currentRequest.setCallback(new Request.Callback() {
@Override
public void onCompleted(Response response) {
requestCompleted(response);
}
});
loading = true;
CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
Request.executeBatchAsync(batch);
}
}
示例3: onSessionStateChange
import com.facebook.Request; //导入方法依赖的package包/类
@Override
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
final TextView txtUserDetails = (TextView) mCurrentView.findViewById(R.id.mapViewLoggedInUser);
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
txtUserDetails.setText("Logged in as " + user.getName());
System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
}
}
});
Request.executeBatchAsync(request);
} else if (session.isClosed()) {
txtUserDetails.setText("");
System.out.println("onSessionStateChange: LoadNotes: session was closed.");
}
}
示例4: onSessionStateChangeP
import com.facebook.Request; //导入方法依赖的package包/类
private void onSessionStateChangeP(Session session, SessionState state, Exception exception)
{
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
LoggedInUser = user;
}
}
});
Request.executeBatchAsync(request);
} else if (session.isClosed()) {
LoggedInUser = null;
}
onSessionStateChange(session, state, exception);
}
示例5: onSessionStateChange
import com.facebook.Request; //导入方法依赖的package包/类
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
if (session != null && session.isOpened()) {
logAndShowOnScreen("\nLogged in. Getting user details.");
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
loadNotes(getActivity(), user.getId());
}
}
});
Request.executeBatchAsync(request);
} else {
logAndShowOnScreen("\nUser not already logged in.");
System.out.println("onSessionStateChange: LoadNotes: session was closed.");
loadNotes(getActivity(), getLoggedInUsername());
}
}
示例6: populateLoggedInUser
import com.facebook.Request; //导入方法依赖的package包/类
private void populateLoggedInUser() {
final TextView txtUserDetails = (TextView) this.getActivity().findViewById(R.id.userDetails);
final Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// If the session is open, make an API call to get user data
// and define a new callback to handle the response
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
// If the response is successful
if (session == Session.getActiveSession()) {
if (user != null) {
String user_ID = user.getId();//user id
String profileName = user.getName();//user's profile name
txtUserDetails.setText(user.getName());
}
}
}
});
Request.executeBatchAsync(request);
} else if (session == null || session.isClosed()) {
}
}
示例7: followNextLink
import com.facebook.Request; //导入方法依赖的package包/类
public void followNextLink()
{
if (this.nextRequest != null)
{
this.appendResults = true;
this.currentRequest = this.nextRequest;
this.currentRequest.setCallback(new Request.Callback()
{
public void onCompleted(Response paramAnonymousResponse)
{
GraphObjectPagingLoader.this.requestCompleted(paramAnonymousResponse);
}
});
this.loading = true;
Request.executeBatchAsync(putRequestIntoBatch(this.currentRequest, this.skipRoundtripIfCached));
}
}
示例8: createBuyerChannel
import com.facebook.Request; //导入方法依赖的package包/类
private void createBuyerChannel() {
final Session session = ParseFacebookUtils.getSession();
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
if (user != null) {
facebookId = user.getId();
String c = buyerProfile != null ? buyerProfile + adId : facebookId + adId;
subscribeChannel(c);
publishMessage(c, facebookId, adId);
}
}
}
});
Request.executeBatchAsync(request);
}
}
示例9: fetchUserInfo
import com.facebook.Request; //导入方法依赖的package包/类
private void fetchUserInfo() {
if (fetchUserInfo) {
final Session currentSession = sessionTracker.getOpenSession();
if (currentSession != null) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == sessionTracker.getOpenSession()) {
user = me;
if (userInfoChangedCallback != null) {
userInfoChangedCallback.onUserInfoFetched(user);
}
}
if (response.getError() != null) {
handleError(response.getError().getException());
}
}
});
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
if (userInfoChangedCallback != null) {
userInfoChangedCallback.onUserInfoFetched(user);
}
}
}
}
示例10: startLoading
import com.facebook.Request; //导入方法依赖的package包/类
private void startLoading(Request request, boolean skipRoundtripIfCached, long afterDelay) {
this.skipRoundtripIfCached = skipRoundtripIfCached;
appendResults = false;
nextRequest = null;
currentRequest = request;
currentRequest.setCallback(new Request.Callback() {
@Override
public void onCompleted(Response response) {
requestCompleted(response);
}
});
// We are considered loading even if we have a delay.
loading = true;
final RequestBatch batch = putRequestIntoBatch(request, skipRoundtripIfCached);
Runnable r = new Runnable() {
@Override
public void run() {
Request.executeBatchAsync(batch);
}
};
if (afterDelay == 0) {
r.run();
} else {
Handler handler = new Handler();
handler.postDelayed(r, afterDelay);
}
}
示例11: fetchUserInfo
import com.facebook.Request; //导入方法依赖的package包/类
private void fetchUserInfo()
{
final Session localSession = getSession();
if ((localSession != null) && (localSession.isOpened()))
{
if (localSession != this.userInfoSession)
{
Request localRequest = Request.newMeRequest(localSession, new Request.GraphUserCallback()
{
public void onCompleted(GraphUser paramAnonymousGraphUser, Response paramAnonymousResponse)
{
if (localSession == UserSettingsFragment.this.getSession())
{
UserSettingsFragment.access$002(UserSettingsFragment.this, paramAnonymousGraphUser);
UserSettingsFragment.this.updateUI();
}
if (paramAnonymousResponse.getError() != null)
UserSettingsFragment.this.loginButton.handleError(paramAnonymousResponse.getError().getException());
}
});
Bundle localBundle = new Bundle();
localBundle.putString("fields", REQUEST_FIELDS);
localRequest.setParameters(localBundle);
Request.executeBatchAsync(new Request[] { localRequest });
this.userInfoSession = localSession;
}
}
else
this.user = null;
}
示例12: startLoading
import com.facebook.Request; //导入方法依赖的package包/类
private void startLoading(Request paramRequest, boolean paramBoolean, long paramLong)
{
this.skipRoundtripIfCached = paramBoolean;
this.appendResults = false;
this.nextRequest = null;
this.currentRequest = paramRequest;
this.currentRequest.setCallback(new Request.Callback()
{
public void onCompleted(Response paramAnonymousResponse)
{
GraphObjectPagingLoader.this.requestCompleted(paramAnonymousResponse);
}
});
this.loading = true;
Runnable local3 = new Runnable()
{
public void run()
{
Request.executeBatchAsync(this.val$batch);
}
};
if (paramLong == 0L)
{
local3.run();
return;
}
new Handler().postDelayed(local3, paramLong);
}
示例13: onClickBtnDelete
import com.facebook.Request; //导入方法依赖的package包/类
@OnClick(R.id.b_delete) public void onClickBtnDelete() {
final Session session = ParseFacebookUtils.getSession();
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
if (user != null) {
facebookId = user.getId();
GoRestClient.delete(":8080/ad/" + adId + "/" + session.getAccessToken(),
new JsonHttpResponseHandler() {
@Override public void onSuccess(JSONObject jsonObject) {
Timber.d(jsonObject.toString());
Gson gson = new GsonBuilder().create();
InsertAdFragment.MessagePostAd mes = gson.fromJson(jsonObject.toString(),
InsertAdFragment.MessagePostAd.class);
if (mes.status.equals("OK")) {
Toast.makeText(getApplicationContext(), "Hooray, " +
"your ad has been deleted successfully!", Toast.LENGTH_SHORT
).show();
bus.post(new RefreshEvent("RefreshMyAdsAdapter"));
ViewActivity.this.finish();
}
}
}
);
}
}
}
});
Request.executeBatchAsync(request);
}
}
示例14: checkFacebookLogin
import com.facebook.Request; //导入方法依赖的package包/类
private String checkFacebookLogin() {
final Session session = ParseFacebookUtils.getSession();
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
facebookId = user.getId();
}
}
});
Request.executeBatchAsync(request);
}
return facebookId;
}
示例15: onSessionStateChange
import com.facebook.Request; //导入方法依赖的package包/类
private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
session = Session.getActiveSession();
if (session.isOpened()) {
/*
CacheData.getInstant().setUrlFaceBook(URL_PREFIX+session.getAccessToken());
Log.i("Urltessttttttttt",URL_PREFIX+session.getAccessToken());
AuthenticationManager manager = new AuthenticationManager();
manager.getUserInfoFaceBook(new AuthenticationManager.OnPaserInfoFaceBookResult() {
@Override
public void onPaserInfoFaceBookResult(boolean isSuccess,
final CacheUser cacheUser, String message) {
if(isSuccess){
String urlAvatar = "http://graph.facebook.com/"+cacheUser.getId()+"/picture";
Utils.loadBitmap(urlAvatar, new Utils.OnBitmapResult() {
@Override
public void onBitmapResult(boolean isSuccess, String message, Bitmap bitmap) {
if(isSuccess){
if(bitmap != null){
cacheUser.setAvatar(bitmap);
Log.i("Testbitmap","Bitmap khong null");
}
}
}
});
CacheData.getInstant().setCacheUser(cacheUser);
Log.i("Test du lieu",CacheData.getInstant().getCacheUser().getEmail() + CacheData.getInstant().getCacheUser().getAvatar());
Intent intent = new Intent(getActivity(),TaskActivity.class);
startActivity(intent);
}
}
});
*/
Request request = Request.newMeRequest(session,new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if( user != null){
Log.i("Email",(String)user.getProperty("email"));
Log.i("Email",user.getId());
Log.i("Email",user.getBirthday());
Log.i("Email",user.getFirstName());
Log.i("Email",user.getLastName());
Log.i("Email",user.getUsername());
}
}
});
Request.executeBatchAsync(request);
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}