本文整理汇总了Java中com.facebook.Request.GraphUserCallback类的典型用法代码示例。如果您正苦于以下问题:Java GraphUserCallback类的具体用法?Java GraphUserCallback怎么用?Java GraphUserCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphUserCallback类属于com.facebook.Request包,在下文中一共展示了GraphUserCallback类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onLoginFacebookCallback
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void onLoginFacebookCallback(final Session paramSession)
{
if (paramSession.isOpened())
Request.newMeRequest(paramSession, new Request.GraphUserCallback()
{
public void onCompleted(GraphUser paramAnonymousGraphUser, Response paramAnonymousResponse)
{
if (paramAnonymousGraphUser != null)
{
FacebookFriendsFragment.access$202(FacebookFriendsFragment.this, paramSession.getAccessToken());
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = FacebookFriendsFragment.this.fbAccessToken;
ךּ.ˊ("REQUEST_FB_LINKING", arrayOfObject);
}
}
}).executeAsync();
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:FacebookFriendsFragment.java
示例2: GetFacebookUserInfo
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private static void GetFacebookUserInfo(final GetFBUserIDRequestHandler requestHandler)
{
Session session = Session.getActiveSession();
if(isFBSessionOpen())
{
Request meRequest = Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if(user != null) {
requestHandler.onCompletion(user);
} else {
requestHandler.onCompletion(null);
}
}
});
meRequest.executeAsync();
} else {
OKLog.v("Tried to get FB user ID without being logged into FB");
requestHandler.onCompletion(null);
}
}
开发者ID:Gameeso,项目名称:openkit-android,代码行数:24,代码来源:FacebookUtilities.java
示例3: onFacebookLinkClick
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
public void onFacebookLinkClick()
{
if (!ﺩ.ˋ("PREF_IS_FACEBOOK_LINKED"))
{
Session.openActiveSession(getActivity(), this, true, new Session.StatusCallback()
{
public void call(final Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
{
if (paramAnonymousSession.isOpened())
Request.executeMeRequestAsync(paramAnonymousSession, new Request.GraphUserCallback()
{
public void onCompleted(GraphUser paramAnonymous2GraphUser, Response paramAnonymous2Response)
{
if (paramAnonymous2GraphUser != null)
{
SettingsFragment.access$002(SettingsFragment.this, paramAnonymousSession.getAccessToken());
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = SettingsFragment.this.fbAccessToken;
ךּ.ˊ("REQUEST_FB_LINKING", arrayOfObject);
}
}
});
}
});
return;
}
ⅹ localⅹ = QuizApplication.ˊ.ˋ;
int i;
if ((localⅹ.ˏ != null) && (!localⅹ.ˏ.equals("")))
i = 1;
else
i = 0;
if (i != 0)
{
ךּ.ˊ("REQUEST_FB_UNLINK", new Object[0]);
return;
}
showUnlinkNotAllowedError();
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:40,代码来源:SettingsFragment.java
示例4: fetchUserInfo
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void fetchUserInfo()
{
if (this.fetchUserInfo)
{
final Session localSession = this.sessionTracker.getOpenSession();
if (localSession != null)
{
if (localSession != this.userInfoSession)
{
Request.executeBatchAsync(new Request[] { Request.newMeRequest(localSession, new Request.GraphUserCallback()
{
public void onCompleted(GraphUser paramAnonymousGraphUser, Response paramAnonymousResponse)
{
if (localSession == LoginButton.this.sessionTracker.getOpenSession())
{
LoginButton.access$502(LoginButton.this, paramAnonymousGraphUser);
if (LoginButton.this.userInfoChangedCallback != null)
LoginButton.this.userInfoChangedCallback.onUserInfoFetched(LoginButton.this.user);
}
if (paramAnonymousResponse.getError() != null)
LoginButton.this.handleError(paramAnonymousResponse.getError().getException());
}
}) });
this.userInfoSession = localSession;
}
}
else
{
this.user = null;
if (this.userInfoChangedCallback != null)
this.userInfoChangedCallback.onUserInfoFetched(this.user);
}
}
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:35,代码来源:LoginButton.java
示例5: fetchUserInfo
import com.facebook.Request.GraphUserCallback; //导入依赖的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;
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:31,代码来源:UserSettingsFragment.java
示例6: requestAccountName
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
/**
* Asynchronously requests the user name associated with the linked account. Requires an opened active
* {@link Session}.
*
* @param graphUserCallback a {@link GraphUserCallback} when the request completes.
* @return true if the request is made; false if no opened {@link Session} is active.
*/
boolean requestAccountName(GraphUserCallback graphUserCallback) {
boolean isSuccessful = false;
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
Request.newMeRequest(session, graphUserCallback).executeAsync();
isSuccessful = true;
}
return isSuccessful;
}
开发者ID:groundupworks,项目名称:wings,代码行数:18,代码来源:FacebookEndpoint.java
示例7: requestAccountName
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
/**
* Asynchronously requests the user name associated with the linked account. Tries to finish the
* {@link FacebookSettingsActivity} when completed.
*/
private void requestAccountName() {
GraphUserCallback callback = new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
FacebookSettingsActivity activity = (FacebookSettingsActivity) getActivity();
if (activity == null || activity.isFinishing()) {
return;
}
if (response != null && response.getError() == null && user != null) {
String accountName = user.getFirstName() + " " + user.getLastName();
if (accountName != null && accountName.length() > 0) {
activity.mAccountName = accountName;
} else {
activity.mHasErrorOccurred = true;
}
} else {
activity.mHasErrorOccurred = true;
}
activity.tryFinish();
}
};
mFacebookEndpoint.requestAccountName(callback);
}
开发者ID:groundupworks,项目名称:wings,代码行数:31,代码来源:FacebookAlbumListFragment.java
示例8: getFriends
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void getFriends(final Context context, final Session session,
final ModelCallback<JSONArray> callback) {
Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(final GraphUser user, Response response) {
if (response.getError() != null) {
callback.error(response.getError().getException());
return;
}
getFriends(context, session, user, callback);
}
}).executeAsync();
}
开发者ID:buddycloud,项目名称:buddycloud-android,代码行数:14,代码来源:FacebookContactMatcher.java
示例9: login
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void login() {
try {
if (Session.getActiveSession() == null
|| Session.getActiveSession().isClosed()) {
Session.openActiveSession(getActivity(), true, new StatusCallback() {
@SuppressWarnings("deprecation")
@Override
public void call(Session session, SessionState state,
Exception exception) {
System.out.println("State= " + state);
if (session.isOpened()) {
System.out.println("Token=" + session.getAccessToken());
mPrefs.edit().putString("fbToken", session.getAccessToken()).commit();
Request.executeMeRequestAsync(session,
new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
System.out.println("User=" + user);
}
pd.dismiss();
}
});
}
if (exception != null) {
System.out.println("Some thing bad happened!");
exception.printStackTrace();
pd.dismiss();
GlobalMethods.showMessage(getActivity(), "Facebook connect failed.");
}
}
});
}
} catch (Exception e) {
pd.dismiss();
e.printStackTrace();
GlobalMethods.showMessage(getActivity(), getString(R.string.internet_error));
}
}
开发者ID:theelookdeveloper,项目名称:CodePix-Android,代码行数:52,代码来源:SettingsFragment.java
示例10: login
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void login() {
try {
if (Session.getActiveSession() == null
|| Session.getActiveSession().isClosed()) {
Session.openActiveSession(ImageDistortedUploadActivity.this, true, new StatusCallback() {
@SuppressWarnings("deprecation")
@Override
public void call(Session session, SessionState state,
Exception exception) {
System.out.println("State= " + state);
if (session.isOpened()) {
System.out.println("Token=" + session.getAccessToken());
mPrefs.edit().putString("fbToken", session.getAccessToken()).commit();
Request.executeMeRequestAsync(session,
new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
System.out.println("User=" + user);
}
pd.dismiss();
}
});
}
if (exception != null) {
System.out.println("Some thing bad happened!");
exception.printStackTrace();
pd.dismiss();
GlobalMethods.showMessage(getApplicationContext(), "Facebook Share failed.");
}
}
});
}
} catch (Exception e) {
// TODO Auto-generated catch block
pd.dismiss();
e.printStackTrace();
GlobalMethods.showMessage(getApplicationContext(), getString(R.string.internet_error));
}
}
开发者ID:theelookdeveloper,项目名称:CodePix-Android,代码行数:49,代码来源:ImageDistortedUploadActivity.java
示例11: loginToFacebook
import com.facebook.Request.GraphUserCallback; //导入依赖的package包/类
private void loginToFacebook() {
openActiveSession(this, true, new StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Session.setActiveSession(session);
Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
Log.d("facebook name", user.getName() + " " + user.asMap().get("email"));
String userimage = "http://graph.facebook.com/" + user.getId() + "/picture?style=small";
Editor editor = sharedPreferences.edit();
editor.putString(Config.ACCOUNT, "Facebook");
editor.putString(Config.NAME, "Name: " + user.getName());
editor.putString(Config.IMAGE, userimage);
String location = null;
try {
location = user.getLocation().getCity();
if (location == null || location.equals(""))
location = "Not found";
} catch (Exception e) {
e.printStackTrace();
location = "Not found";
}
String data = "UserName: " + user.getUsername() + "\n" + "Location: " + location + "\n";
editor.putString(Config.DATA, data);
editor.commit();
/*
* HashMap<String, String> map = new
* HashMap<String, String>(); map.put("account",
* "Google+"); map.put("name",
* "Name:\n"+user.getFirstName
* ()+" "+user.getLastName()); map.put("image",
* userimage); String data =
* "UserName: "+user.getUsername()+"\n"+
* "Location: "+user.getLocation()+"\n";
* map.put("userData", data);
*/
// in.putExtra("data", map);
startActivity(new Intent(MainActivity.this, ResultActivity.class));
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
finish();
}
}
}).executeAsync();
}
}
}, Arrays.asList("email", "publish_actions"));
}
开发者ID:mastersoftwaresolutions,项目名称:android_socialmedia,代码行数:56,代码来源:MainActivity.java
注:本文中的com.facebook.Request.GraphUserCallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论