w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Prevent duplicate entries on Parse.com?

I've already faced this problem in iOS, and seems that Android can be solved in the same way. So, you can mix the FB API with the parse function

ParseFacebookUtils.logIn(String facebookId, String accessToken,
Date expirationDate, LogInCallback callback) 

relying to facebook app you can obtain the facebookId, accessToken ( i think that for the expirationDate you can set a far date, like what i've done for iOS )

Another solution is:

ParseFacebookUtils.logIn(Arrays.asList(Permissions.User.EMAIL),
                    this, new LogInCallback() {
                        @Override
                        public void done(ParseUser user, ParseException
err) {
                            Do your stuff...
                        }
                    });

it should automatically detect if an user with that facebook id already exist in your _User table or not ( i can confirm this on iOS, you can check if the user is new or still exist with user.isNew() ). If you need you could also save the retrieved facebookId in a separated field, but i think you could avoid it for this scope

Hope it helps





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.