Using share dialog in Android Facebook SDK. How to know is user actually shared or cancelled sharing activity?

前端 未结 6 2223
無奈伤痛
無奈伤痛 2021-01-11 09:41

I have added sharing functionality to Android app as described here https://developers.facebook.com/docs/android/share-dialog/#setup

But I have noticed that if user

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-11 09:56

    In order to obtain the result for the sharing, your app needs to have at least the basic_info permission.

    To solve that, just open an session (this will automatically request the basic_info permission):

    Session.openActiveSession(this /*your activity*/, 
                              true /*allows the UI login to show up if needed*/, 
                              new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            Log.i("[Facebook]", "Session: " + state.toString());
            if (session.isOpened()) {
               /// now you are good to get the sharing results
            }
        }
    });
    

    You can find more information in here: https://developers.facebook.com/docs/android/getting-started/

提交回复
热议问题