Reputation: 492
I have a Facebook Session.but it is not open. i tried to get AccessToken as follows
Session.getActiveSession().getAccessToken();
but it does not return any thing.how can i get the AccessToken?
Upvotes: 1
Views: 283
Reputation: 15662
You almost never need to extract the actual access token anymore. Any requests to the graph API can be done with the Request class and a Session object.
Upvotes: 0
Reputation: 12587
well, as written in the official documentation, you need to have a UiLifecycleHelper
that will make sure to create a valid session for every fragment that interacts with the Facebook SDK.
what you should do is override the life cycle methods in your fragment (or activity) and then Session.getActiveSession()
will return a session if there is one.
Upvotes: 1