0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
100rabh
  • 6,156
  • 5
  • 27
  • 41

1 Answers1

0

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.

Ming Li
  • 15,672
  • 3
  • 37
  • 35
  • do you mean I wont get a active session from LikeView? – 100rabh Feb 24 '15 at 09:00
  • I am testing it without native facebook app. Facebook SDK is opening a Webview for like. – 100rabh Feb 24 '15 at 09:07
  • 1
    If the facebook app is not installed, it will fall back to using the webview. In either case, your code will not get an active session (since the user is NOT auth'ing your app). – Ming Li Feb 24 '15 at 21:08
  • Thanks . I had been fiddling with it for long. – 100rabh Feb 25 '15 at 05:57
  • It could be a feature request then because I am using the same app Id for Like & Share. – 100rabh Feb 25 '15 at 05:58
  • The fact that you don't get a session when you use Like and Share (via the dialogs or Like button) is by design. The user is not granting your app any permissions, so you don't get a session. If you want a session, you need to use Facebook Login. – Ming Li Feb 26 '15 at 18:37
  • So if I use Facebook Login what can I use for liking my page. I found no alternative for "Like" (I want to use same Like icon that LikeView provides) – 100rabh Feb 27 '15 at 08:13
  • The Like Button/LikeView is the only thing that will work for liking a Page. Whether you use login or not is completely orthogonal. – Ming Li Feb 27 '15 at 17:55