android - Social Network Plugin doesn't login -
i use socialnetwork plugin android prime31 (here) in project facebook.
if use demo scene - work good. if in single window create 3 buttons (init, login, share) work good. if use facebookandroid.init()
in first update (or awake
or start
) , login in window of game - after login fb window session isn't valid , can't share anything.
list of facebook controller:
public class facebookcontroller : monobehaviour { public static facebookcontroller instance; void awake () { instance = this; } private bool isfirst = true; void update () { if (isfirst) { isfirst = false; #if unity_android facebookandroid.init(); #endif } } public void login() { #if unity_android var permissions = new string[] { "publish_actions", "publish_stream" }; facebookandroid.setsessionloginbehavior(facebooksessionloginbehavior.suppress_sso); facebookandroid.loginwithpublishpermissions(permissions); #endif } public void logoff() { #if unity_android facebookandroid.logout(); #endif } public bool islogged() { #if unity_android facebookandroid.issessionvalid(); #endif return false; } public void share(string name, string message) { #if unity_android if (facebookandroid.issessionvalid()) { var parameters = new dictionary<string, object> { { "link", "http://prime31.com" }, { "name", name }, { "picture", "http://prime31.com/assets/images/prime31logo.png" }, { "caption", message } }; facebookandroid.showfacebooksharedialog(parameters); } #endif } }
Comments
Post a Comment