How to Share Image using Facebook android

前端 未结 3 1544
被撕碎了的回忆
被撕碎了的回忆 2020-12-20 01:13

I am trying to share Image and Content via Facebook,but what i am trying is if user is not logged in via Facebook,and user click on Share button then first it should ask for

3条回答
  •  佛祖请我去吃肉
    2020-12-20 01:41

    First time when you try to log in, access token is null. So, it is going on else part. Do this in else part, I think so it may work for you :

    LoginManager.getInstance().registerCallback(mcallbackManager, new FacebookCallback()
                {
                @Override
                public void onSuccess(LoginResult loginResult) {
    
                    GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject jsonObject, GraphResponse graphResponse) {
    
    }
    });
    
    }
    });
    

提交回复
热议问题