While going through the sample program for Facebook Login, I came across SessionLoginSample's LoginUsingActvity.java
https://github.com/facebook/facebook-android-sdk/blob/master/samples/SessionLoginSample/src/com/facebook/samples/sessionlogin/LoginUsingActivityActivity.java
and another example has different approach to Login using UiLifecycleHelper as in Scrumptious example https://github.com/facebook/facebook-android-sdk/blob/master/samples/Scrumptious/src/com/facebook/scrumptious/MainActivity.java
What is the difference b/w those two types which one should i fallow for a simple Login with few permissions i am interested .
One more method i came across is using OpenRequest
OpenRequest op = new Session.OpenRequest((Activity) this);
op.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
op.setCallback(null);
List<String> permissions = new ArrayList<String>();
permissions.add("user_likes");
permissions.add("email");
permissions.add("user_birthday");
op.setPermissions(permissions);
Session session = new Builder(this).build();
Session.setActiveSession(session);
session.openForRead(op);
I am confused a lot to known which could be the best approach ,if there are more than one way to Login.
Every approach works well. The new thing is SDK 3.0 is session management. You just have to manage session state. Apart from your code I will state 3 more and then I'll tell you when to use them.
1.
2.
3.
Use 3rd approach in devices 2.3 or lower because previous ones shows unexpected error on most cases.