- Forum posts: 2
Sep 11, 2013, 10:22:05 AM via Website
Sep 11, 2013 10:22:05 AM via Website
2 @Override
3 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
4
5 final View v = super.onCreateView(inflater, container, savedInstanceState);
6 setTitle("Sign In");
7 reloadTemplate();
8 return v;
9 }
10
11 @Override
12 public boolean executeCommand(BaseWebView webView, String command, String data) {
13
14 if (command.equalsIgnoreCase("login")) {
15 Session session = Session.getActiveSession();
16
17 if (session != null && session.isOpened()) {
18 loginWithFBToken(session.getAccessToken());
19 return;
20 }
21
22 Session.openActiveSession(getActivity(), true, callback);
23 }
24
25 return true;
26 }
27
28 private Session.StatusCallback callback = new Session.StatusCallback() {
29
30 @Override
31 public void call(Session session, SessionState state, Exception exception) {
32 onSessionStateChange(session, state, exception);
33 }
34 };
35
36 private void onSessionStateChange(Session session, SessionState state, Exception exception) {
37 if (state.isOpened()) {
38 // Facebook logged in...
39
40 } else if (state.isClosed()) {
41 //Facebook logged out...
42 }
43 }
44
45}
In my main activity I've supplied the overriden method:
2 public void onActivityResult(int requestCode, int resultCode, Intent data) {
3 super.onActivityResult(requestCode, resultCode, data);
4 Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
5 }
After the Session.openActiveSession() call, on the 1st entrance to onSessionsStateChange() function, I have
On the 2nd entrance to this function, I have
What does that mean?