开发者

Android Facebook

开发者 https://www.devze.com 2023-02-02 16:16 出处:网络
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-andro

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消