Search code examples
androidfacebookandroid-fragmentsfacebook-likefacebook-android-sdk

Android: Facebook LikeView's session is not accessible


We are using LikeView provided in Facebook SDK. Initially when LikeView is tapped it asks for login and gets authenticated and shows me a window to like the object. But now when I try to access the session using Session.getActiveSession() it gives me a closed session & then when I do Session.openActiveSession(MyActivity.this,true, callback); it asks me to login again.

Flow is like MyActivity -(contains)->MyParentFragment-(contains)->ChildFragment

My likeview is in MyParentFragment & I am trying to access Session from a ChildFragment to post Status Update on Facebook.

Is there a way I can use the same session LikeView used.

EDIT: I want that if user is logged into Fb using Likeview then he should not login again for posting status.


Solution

  • No. The case you're describing is when the LikeView switches over to the Facebook app, and the user is prompted to log in there if they haven't already. The session belongs to the Facebook app, and it is the one that's liking the page on the user's behalf (the user hasn't authorized your app or given it any permissions).

    In that sense, there is no session in your app at all.