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_stre开发者_StackOverflowam", "read_stream", "offline_access"}, this);
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.
Probably wherever the entry point for your app is; I'm guessing MainActivity.
精彩评论