Replacement for outdated Facebook code for Android

I want to know the exact replacement of the code below without outdated code. Moreover, I want to try it in the new SDK 3.0 for Facebook.

Facebook aFacebook = new Facebook("app_id"); if( !aFacebook.isSessionValid() ) { aFacebook.authorize(this, new String[] { "email" }, new LoginDialogListener()); } 

I've tried a lot. But it didn’t work out.

TIA

+6
source share
1 answer

Since this question has no answer, I am writing it.

The 3.0 Facebook SDK for Android uses the Session class to login. Initially, as mentioned in the question, the authorization method was used.

Code to accurately replace the code mentioned in the question:

 Session session = Session.getActiveSession(); if (session == null) { session = new Session(getApplicationContext()); } Session.setActiveSession(session); 
+5
source

All Articles