问题描述
我是 android 的新手 - facebook 集成.
我正在尝试将我的应用程序与 facebook 集成,所以我按照 facebook 教程,并且一切正常(至少我能够执行登录).
但是当我尝试使用以下代码时,我意识到我无法从 Facebook 导入库:
i'm new on android - facebook integration.
I'm trying to integrate my app with facebook, so i follow all the steps on the facebook tutorial, and things work fine (at least i'm abble to perform the login).
But when i try to use this following code, i realize that i can't import the library from the Facebook:
会话会话 = Session.getActiveSession();
我使用的是 Android Studio,IDE 只给了我导入 android.service.textservice.SpellCheckerService 的选项,但我想正确的导入是 com.facebook.Session
对我在这里缺少什么有任何想法吗?
PS: FB SDK 版本是 facebook-android-sdk-4.5.1
I'm using Android Studio, and the IDE only give me the option to import the android.service.textservice.SpellCheckerService, but i guess that the right import is com.facebook.Session
Any ideas of what i'm missing here?
PS: FB SDK version is facebook-android-sdk-4.5.1
推荐答案
Facebook 在新 SDK 中删除会话.检查我对同一问题的回答一个>
Facebook remove session in new SDK. check my answer for same question
我提供了完整的集成代码.
there full integration code is given by me.
您可以通过此代码检查用户是否登录.
you can check whether user is logged in or not by this code.
profile = Profile.getCurrentProfile().getCurrentProfile();
if (profile != null) {
// user has logged in
} else {
// user has not logged in
}
这篇关于Android - Facebook 集成:无法导入 com.facebook.Session的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!