本文整理汇总了Java中com.facebook.Session.StatusCallback类的典型用法代码示例。如果您正苦于以下问题:Java StatusCallback类的具体用法?Java StatusCallback怎么用?Java StatusCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StatusCallback类属于com.facebook.Session包,在下文中一共展示了StatusCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectFacebook
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void connectFacebook()
{
if ((Session.getActiveSession() != null) && (Session.getActiveSession().isOpened()))
{
int i;
if (!TextUtils.isEmpty(QuizApplication.ˊ.ˋ.゙))
i = 1;
else
i = 0;
if (i != 0)
{
requestFriendPermission(Session.getActiveSession());
return;
}
}
Session.StatusCallback local2 = new Session.StatusCallback()
{
public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
{
FacebookFriendsFragment.this.onLoginFacebookCallback(paramAnonymousSession);
}
};
Session.openActiveSession(getActivity(), this, true, local2);
}
示例2: requestFriendPermission
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void requestFriendPermission(Session paramSession)
{
Session.NewPermissionsRequest localNewPermissionsRequest = new Session.NewPermissionsRequest(this, Arrays.asList(new String[] { "user_friends" }));
localNewPermissionsRequest.setCallback(new Session.StatusCallback()
{
public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
{
if (FacebookFriendsFragment.hasFriendsPermission(paramAnonymousSession.getPermissions()))
{
ί localί = ((FriendsTabActivity)FacebookFriendsFragment.this.getActivity()).getErrorDialog();
localί.ʼ.removeView(localί.ʻ);
localί.ˊ();
FacebookFriendsFragment.this.getFriendsFromFacebook(paramAnonymousSession);
}
}
});
paramSession.requestNewReadPermissions(localNewPermissionsRequest);
}
示例3: init
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public static void init(String appID) {
Session session;
if (FB.isLoggedIn()) {
session = Session.getActiveSession();
// this shouldn't be an issue for most people: the app id in the session not matching the one provided
// instead it can probably happen if a developer wants to switch app ids at run time.
if (appID != session.getApplicationId()) {
Log.w(FB.TAG, "App Id in active session ("+ session.getApplicationId() +") doesn't match App Id passed in: " + appID);
session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
}
} else {
session = new Builder(FB.getUnityActivity()).setApplicationId(appID).build();
}
Session.setActiveSession(session);
final UnityMessage unityMessage = new UnityMessage("OnInitComplete");
unityMessage.put("key_hash", FB.getKeyHash());
// if there is an existing session, reopen it
if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
Session.StatusCallback finalCallback = getFinalCallback(unityMessage, null);
sessionOpenRequest(session, finalCallback, FB.getUnityActivity(), null, false);
} else {
unityMessage.send();
}
}
示例4: login
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public static void login(Activity activity, final SocialCallback callback)
throws ScoreflexFacebookWrapper.FacebookException {
if (!isFacebookAvailable(activity))
throw new ScoreflexFacebookWrapper.FacebookException(
"Facebook SDK is not available");
try {
Session.openActiveSession(activity, true, new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
String accessToken = null;
if (null != session && session.isOpened())
accessToken = session.getAccessToken();
callback.call(accessToken, exception);
}
});
} catch (Exception e) {
throw new FacebookException(e);
}
}
示例5: showDialogWithoutNotificationBar
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static void showDialogWithoutNotificationBar(final Activity activity,
final String action, final Bundle params, final SocialShareCallback callback) {
Session fbSession = Session.openActiveSessionFromCache(activity);
if (fbSession == null) {
Session.openActiveSession(activity, true,
new StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (null != session && session.isOpened()) {
showDialog(activity, session, action, params, callback);
}
}
});
} else {
showDialog(activity, fbSession, action, params, callback);
}
}
示例6: getOpenRequest
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions) {
OpenRequest req = new OpenRequest(getActivity());
req.setCallback(callback);
req.setPermissions(permissions);
req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
return req;
}
示例7: getNewPermissionsRequest
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.NewPermissionsRequest getNewPermissionsRequest(Session session, StatusCallback callback, List<String> permissions) {
Session.NewPermissionsRequest req = new Session.NewPermissionsRequest(getActivity(), permissions);
req.setCallback(callback);
// This should really be "req.setCallback(callback);"
// Unfortunately the current underlying SDK won't add the callback when you do it that way
// TODO: when upgrading to the latest see if this can be "req.setCallback(callback);"
// if it still doesn't have it, file a bug!
session.addCallback(callback);
req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
return req;
}
示例8: onFacebookLinkClick
import com.facebook.Session.StatusCallback; //导入依赖的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();
}
示例9: SessionTracker
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public SessionTracker(Context paramContext, Session.StatusCallback paramStatusCallback, Session paramSession, boolean paramBoolean)
{
this.callback = new CallbackWrapper(paramStatusCallback);
this.session = paramSession;
this.receiver = new ActiveSessionBroadcastReceiver(null);
this.broadcastManager = con.ˊ(paramContext);
if (paramBoolean)
startTracking();
}
示例10: authorize
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private void authorize(Activity paramActivity, String[] paramArrayOfString, int paramInt, SessionLoginBehavior paramSessionLoginBehavior, final DialogListener paramDialogListener)
{
checkUserSession("authorize");
this.pendingOpeningSession = new Session.Builder(paramActivity).setApplicationId(this.mAppId).setTokenCachingStrategy(getTokenCache()).build();
this.pendingAuthorizationActivity = paramActivity;
String[] arrayOfString;
if (paramArrayOfString != null)
arrayOfString = paramArrayOfString;
else
arrayOfString = new String[0];
this.pendingAuthorizationPermissions = arrayOfString;
Session.StatusCallback local1 = new Session.StatusCallback()
{
public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
{
Facebook.this.onSessionCallback(paramAnonymousSession, paramAnonymousSessionState, paramAnonymousException, paramDialogListener);
}
};
Session.OpenRequest localOpenRequest = new Session.OpenRequest(paramActivity).setCallback(local1).setLoginBehavior(paramSessionLoginBehavior).setRequestCode(paramInt).setPermissions(Arrays.asList(this.pendingAuthorizationPermissions));
Session localSession = this.pendingOpeningSession;
boolean bool;
if (this.pendingAuthorizationPermissions.length > 0)
bool = true;
else
bool = false;
openSession(localSession, localOpenRequest, bool);
}
示例11: onActivityCreated
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
public void onActivityCreated(Bundle paramBundle)
{
super.onActivityCreated(paramBundle);
this.sessionTracker = new SessionTracker(getActivity(), new Session.StatusCallback()
{
public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
{
if (!paramAnonymousSession.isOpened())
PickerFragment.this.clearResults();
}
});
setSettingsFromBundle(paramBundle);
this.loadingStrategy = createLoadingStrategy();
this.loadingStrategy.attach(this.adapter);
this.selectionStrategy = createSelectionStrategy();
this.selectionStrategy.readSelectionFromBundle(paramBundle, "com.facebook.android.PickerFragment.Selection");
if (this.showTitleBar)
inflateTitleBar((ViewGroup)getView());
if ((this.activityCircle != null) && (paramBundle != null))
{
if (paramBundle.getBoolean("com.facebook.android.PickerFragment.ActivityCircleShown", false))
{
displayActivityCircle();
return;
}
hideActivityCircle();
}
}
示例12: getAfterReadPermissionLoginCallback
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.StatusCallback getAfterReadPermissionLoginCallback(final UnityMessage unityMessage, final List<String> publishPermissions, final Activity activity) {
return new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.getState().equals(SessionState.OPENING)){
return;
}
session.removeCallback(this);
if (!session.isOpened() && state != SessionState.CLOSED_LOGIN_FAILED) {
unityMessage.sendError("Unknown error while opening session. Check logcat for details.");
activity.finish();
return;
}
// if someone cancels on the read permissions and we don't even have the most basic access_token
// for basic info, we shouldn't be asking for publish permissions. It doesn't make sense
// and it simply won't work anyways.
if (session.getAccessToken() == null || session.getAccessToken().equals("")) {
unityMessage.putCancelled();
unityMessage.send();
activity.finish();
return;
}
//ask for publish permissions, if necessary.
if(session.getPermissions().containsAll(publishPermissions)) {
finalizeLogin(session, state, exception, unityMessage, activity);
} else {
Session.StatusCallback finalCallback = getFinalCallback(unityMessage, activity);
sessionOpenRequest(session, finalCallback, activity, publishPermissions, true);
}
}
};
}
示例13: getFinalCallback
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.StatusCallback getFinalCallback(final UnityMessage unityMessage, final Activity activityToClose) {
return new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.getState().equals(SessionState.OPENING)){
return;
}
session.removeCallback(this);
finalizeLogin(session, state, exception, unityMessage, activityToClose);
}
};
}
示例14: getOpenRequest
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions, Activity activity) {
OpenRequest req = new OpenRequest(activity);
req.setCallback(callback);
req.setPermissions(permissions);
req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
return req;
}
示例15: getNewPermissionsRequest
import com.facebook.Session.StatusCallback; //导入依赖的package包/类
private static Session.NewPermissionsRequest getNewPermissionsRequest(Session session, StatusCallback callback, List<String> permissions, Activity activity) {
Session.NewPermissionsRequest req = new Session.NewPermissionsRequest(activity, permissions);
req.setCallback(callback);
// This should really be "req.setCallback(callback);"
// Unfortunately the current underlying SDK won't add the callback when you do it that way
// TODO: when upgrading to the latest see if this can be "req.setCallback(callback);"
// if it still doesn't have it, file a bug!
session.addCallback(callback);
req.setDefaultAudience(SessionDefaultAudience.FRIENDS);
return req;
}