Android:向特定用户发送推送通知

Android: Send push-notifications to specific user

我第一次尝试使用parse.com。

我知道我可以用这个创建用户:

ParseUser user = new ParseUser();
            user.setUsername(userName);
            user.setPassword(password);
            user.setEmail("email@example.com");
            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
                    }
                }
            });

现在我想知道,以后如何以用户身份登录以及如何向特定用户发送推送通知?

您可以使用 logInInBackground 方法登录

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.
    }
  }
});

要向用户发送推送通知,您需要将 ParseUser 指针或用户名等唯一值添加到 ParseInstallation,然后您可以使用唯一渠道或 advanced targeting