progNewbie
progNewbie

Reputation: 4822

Android: Send push-notifications to specific user

I try to use parse.com for the first time.

I know that I can create users with this:

ParseUser user = new ParseUser();
            user.setUsername(userName);
            user.setPassword(password);
            user.setEmail("[email protected]");
            user.signUpInBackground(new SignUpCallback() {
                public void done(ParseException e) {
                    if (e == null) {
                        // Hooray! Let them use the app now.
                    } else {
                        // Sign up didn't succeed. Look at the ParseException
                        // to figure out what went wrong
                    }
                }
            });

Now I wonder, how I can later login as a user and how can I send a push-notification to a specific user?

Upvotes: 0

Views: 187

Answers (1)

Dave S
Dave S

Reputation: 3468

You can login using the logInInBackground method

ParseUser.logInInBackground("myUsername", "myPassword", new 

LogInCallback() {
  public void done(ParseUser user, ParseException e) {
    if (user != null) {
      // Hooray! The user is logged in.
    } else {
      // Signup failed. Look at the ParseException to see what happened.
    }
  }
});

To send a push notification to the user you need to add the ParseUser pointer or a unique value like the username to the ParseInstallation then you can target the user using a unique channel or advanced targeting

Upvotes: 2

Related Questions