Venkatesh
Venkatesh

Reputation: 1

Android Facebook

For single sign-on where should I include this below code to work..

In FACBOOK.Clas or somewhere else.. or in my main Activity .. I downloaded the code from https://github.com/facebook/facebook-android-sdk

facebookClient = new Facebook(FB_APP_ID);

    facebookClient.authorize(this, 
        new String[] {"publish_stream", "read_stream", "offline_access"}, this);

Upvotes: 0

Views: 364

Answers (2)

dsr
dsr

Reputation: 1316

You can put the code in a separate class meant for authentication and call the authentication method from your MainActivity. You just need to store the access token, expire token etc. in the SharedPreferences. Take a look at the Facebook sample app in the Facebook SDK for Android for guidance.

Upvotes: 1

harrisonlee
harrisonlee

Reputation: 5118

Probably wherever the entry point for your app is; I'm guessing MainActivity.

Upvotes: 0

Related Questions