Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Omer.Hussain · Aug 25, 2014 at 12:46 PM · facebook

Auto LogIn into face book

Hi , i connected my game with facebook API to share the result of the game, 2 months back it was working fine. when you click the button it ask for login then you logged into the face and sync your connection and share your result on Facebook.... and if you want to change your facebook account you remove the last account into the mobile account setting and add new one..... now the problem is when we add the account user id and password in the game it sync the account but when i off the game and remove my facebook account from the account setting and open my game , my previous account remain safe in the game and it share data with the last account we added before ........ what i am looking for is either a logout method properly or any other suggestion ... and i have used FB.Logout(); its not helping me out... here is my code

 public class MainMenu : MonoBehaviour {
 
     void Awake(){
         // Initialize FB SDK              
         enabled = false;                  
         FB.Init(SetInit); 
         }
 
 
     private void SetInit()                                                                       
     {                                                                                            
                                                                   
         enabled = true; // "enabled" is a property inherited from MonoBehaviour                  
     }                                                                                            
     
     void OnMouseDown()
     {
 
         if (!FB.IsLoggedIn) {
 
             FB.Login ("email,publish_actions", LoginCallback);  
 
         }
         else if (FB.IsLoggedIn) {
 //            OnLoggedIn();
         onBragClicked ();
                 }
     }
         
     void LoginCallback(FBResult result)                                                        
         {                                                                                          
 //            Util.Log("LoginCallback");                                                          
             
             if (FB.IsLoggedIn)                                                                     
             {                                                                                      
                 OnLoggedIn();                                                                      
             }                                                                                      
         }                                                                                          
         
         void OnLoggedIn()                                                                          
         {                                                                                          
 //        Util.Log("Logged in. ID: " + FB.UserId);
         FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
 //        onBragClicked ();
         }
                                                                                                                              
     void APICallback(FBResult result)
     {
 //        Util.Log("APICallback");
         if (result.Error != null)
         {
             // Let's just try again
             FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
             return;
 
         }
         
 
         onBragClicked();
     }
 
     private void onBragClicked()                                                                                                 
     {    
                                                                                                   
         FB.Feed(                                                                                                                 
                 linkCaption: "I just Found My Love Result." +
                     "Click to Check out your's",               
                 picture: "http://s16.postimg.org/r3fvqk5cl/jhj_3_2_2_2_2.jpg",                                                     
                 linkName: "LoveMeLoveMeNot",                                                                 
                 link:"http://www.brokenfloorstudios.com/"
                 );                                                                                                               
     } 
 
 }
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kiwasi · Aug 26, 2014 at 11:28 AM 0
Share

For future posts pull all of the comments out of your code. It really makes for difficult reading.

avatar image Kiwasi · Aug 26, 2014 at 11:35 AM 1
Share

Basically you need a method to get compare the facebook ID stored on the phone with FB.userID. Then call FB.Logout if they are different, and prompt for another login.

I'm not familiar enough with mobile development to tell you how to get the ID stored in the phone.

avatar image sumeetkhobare · Aug 08, 2015 at 01:19 AM 0
Share

@Bored$$anonymous$$ormon, how to access the facebook data stored on the phone?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

facebook chat is hidden behind unity game 0 Answers

How to share high score(string)/game result data on facebook ...please any one help me ....:(. 2 Answers

"Facebook object not loaded yet" error 3 Answers

Get Facebook User name with Facebook sdk Unity android 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges