Parse Anonymous Utils: how to create just one user?

I have a quick question. I am trying to enable automatic user creation in my application so that when you open it for the first time, one and only one user is created. I read the user's docs carefully and found that Parse continues the user's session on disk and that after saving an object to that user, that user is saved to the cloud. However, I noticed two problems:

1) When I save the object and create a pointer to the user Owner, the custom object does not exist in the cloud.

2) If I check if the current user is linked using ParseAnonUtils.isLinked (), this sometimes returns true, as in the current user, or false, since the current user is not linked, for the same exact ParseUser that was cached in the session.

Here is the method I use to create and define a user:

private void getUser() {
    if (!ParseAnonymousUtils.isLinked(ParseUser.getCurrentUser())) {
        Log.v("Miles", "new user");
        ParseAnonymousUtils.logIn(new LogInCallback() {

            @Override
            public void done(final ParseUser user, ParseException e) {
                if (e == null) {
                  user.setUsername(UUID.randomUUID().toString());
                  user.setPassword(UUID.randomUUID().toString());
                  user.signUpInBackground(new SignUpCallback() {

                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            user.saveInBackground(new SaveCallback() {

                                @Override
                                public void done(ParseException e) {
                                    if (e == null) {
                                        Log.v("Miles", "user saved");
                                    } else {
                                        Log.v("Miles", "user not saved " + String.valueOf(e.getCode()));
                                    }
                                }

                            });
                        } else {
                            Log.v("Miles", "signup fail " + String.valueOf(e.getCode()));
                        }
                    }
                  });
                } else {
                    Log.v("Miles", "anon login fail " + String.valueOf(e.getCode()));
                }
            }
        });
    }
}

      

Help would be greatly appreciated.

+3
java android parse.com


source to share


No one has answered this question yet

Check out similar questions:

2240
How to create an executable JAR with dependencies using Maven?
1376
How to create Java string from file content?
1315
How do I create a file and write it in Java?
1027
How do I create a generic array in Java?
933
How to parse JSON in Java
815
Android "Only the original thread that created the view hierarchy can touch its views."
nine
parse anonymous class does not implement abstract method
0
objectId in Parse is null even though there is no ParseException, storing the object in the Parse cloud
0
An error occurred while trying to create a new user in Parse for Android.
0
Error using SignUpCallback method



All Articles
Loading...
X
Show
Funny
Dev
Pics