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 Gikerowski · Apr 20, 2014 at 05:25 AM · parsefb

How can I check if fb user is new in my database?(Parse+fb)

Hi, I would like to check if fb player (which is currently logging) is new in my database. I heard something about 'isNew()'but I don't know how I should use that. This is an example:

 private void ParseSync (){
 Task logInTask = ParseFacebookUtils.LogInAsync (FB.UserId, FB.AccessToken, FB.AccessTokenExpiresAt);
 
 //if( this is his first time in game/in my database )
 // do something 
 // else 
 // do other stuff
 }

I asked on 'pharse' forum, but I have a feeling that forum is dead :/ :P Thanks!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MichiealO · Aug 08, 2014 at 01:20 PM

         // show the signup or login screen
         Task<ParseUser> logInTask = ParseFacebookUtils.LogInAsync(userId, accessToken, tokenExpiration);
         if (user.ContainsKey ("NotNew") == false) // going assume that this is a new user... so.. create them.
             CreateParseUser();

         if (!ParseFacebookUtils.IsLinked(user)) {
             // links the defined ParseUser to the selected FB user... 
             Task linkTask = ParseFacebookUtils.LinkAsync(user, userId, accessToken, tokenExpiration);
         }

... Then in the create user section, make sure to add:

     if (user.ContainsKey("NotNew")==false) //checks to see if the key exists in the current user...
         user.Add("NotNew",1); // adds the Key to the user, and sets it to 1.
 

This is what I used, I seems to work... The logic behind it is this: when you log them in, Parse automatically does Login/Signup... making the successful result into an existing "CurrentUser". And, if the "NotNew" field is an integer, that gets set to 1 (a true value) when you do your NewUser Code. Then, regardless of "if found" or not, it will tell you whether the currently signed in user is new. [false == new, true == notnew]...

I apologize if it's not 100% perfect, I'm still a tad shaky on the ParseUser stuff...

I hope that this helps or at least points you in the right direction, and if it does, can you up-vote my answer?

Comment
Add comment · Share
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

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

21 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

Related Questions

A node in a childnode? 1 Answer

unity + php get Authentication 0 Answers

Invalid Encoding Specification Xml 1 Answer

Parse Online Storage fails to communicate -1 Answers

CG Shader Properties Parse Error 1 Answer


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