title: Facebook native login using simple java class in android
body: <p>I am creating a simple library project consisting of only java classes.There should  be no activity involvement in it
  I followed the tutorials in facebook's developers page <a href="https://developers.facebook.com/docs/android/" rel="nofollow">https://developers.facebook.com/docs/android/</a></p>
  
  <p>Based on that i tried to implement it on my java class such as</p>
  
  <pre><code>Session.openActiveSession(a,true,new Session.StatusCallback() 
  {
                      @Override   
                      public void call(final Session session, final SessionState state, final Exception exception) 
                      {Log.e("Session",session.getAccessToken());
                          Log.e("Session Status",session.toString());
                          if(session.isOpened())
                          {
                              Toast.makeText(c,session.getAccessToken(),Toast.LENGTH_LONG).show();
                              Log.e("Access Token",session.getAccessToken());
                          }
                          else
                          {
                              Log.e("Session","Not Opened");
  
                          }
  
                      }
                  });
  </code></pre>
  
  <p>Now when i check session value using logger,result is</p>
  
  <pre><code> session {state:OPENING,access_token=ACCESS_TOKEN_REMOVED}
  </code></pre>
  
  <p><strong>My Requirements are :</strong></p>
  
  <ol>
  <li>Simple Library with native login support using simple java classes only No Activity</li>
  <li>Flow is like if a user is already logged-in facebook native app,then my library will retrieve access token from session  else my web view for facebok will continue </li>
  <li>I need only facebook access token</li>
  </ol>