Prevent duplicate entries on

I am building an android app with Facebook login, once logged, it'll save information from Facebook to Parse like Facebook ID, name and profile picture. Is there a way to make a column unique so that it can only have 1 kind of FB ID? or check if FB ID exist in my User table? I know it might seem like a very general request, but I've been googling for hours and can't find any specific solution..


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:

                    this, new LogInCallback() {
                        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

Need Your Help

Render partial view with dynamic model in Razor view engine and ASP.NET MVC 3 razor

When I try to render a partial view whose model type is specified as:

li won't float correctly in IE

html css internet-explorer css-float

I have a very peculiar problem across the IE board (ignoring IE6).