Android Facebook SDK: Check if the user is logged in or not

后端 未结 10 1463
南旧
南旧 2020-12-04 12:43

I\'m have a feature on my Android app where the user authorizes the app and shares a link.

I also need to give an option for the user to logout of facebook and I nee

10条回答
  •  时光取名叫无心
    2020-12-04 13:19

    Android Studio with :

    compile 'com.facebook.android:facebook-android-sdk:4.0.1'
    

    then check login like as:

    private void facebookPost() {
        //check login
        AccessToken accessToken = AccessToken.getCurrentAccessToken();
        if (accessToken == null) {
            Log.d(TAG, ">>>" + "Signed Out");
        } else {
            Log.d(TAG, ">>>" + "Signed In");
        }
    }
    

提交回复
热议问题