2013-05-13 66 views
1

嗨我想为我的项目使用Parse Api的数据库,它需要Parse提供的用户帐户。虽然我在 https://parse.com/docs/android_guide#users阅读如何设置用户帐户的教程它说:emailVerification = false在解析

“在应用程序的设置启用电子邮件验证允许应用程序保留其体验的一部分,用于确认电子邮件地址的用户的电子邮件验证补充道。用于ParseUser对象的emailVerified键,当设置或修改ParseUser的电子邮件时,emailVerified设置为false,然后通过解析将电子邮件发送给用户一个将emailVerified设置为true的链接。

究竟是如何将添加emailVerification键=真每当用户尝试注册:

ParseUser user = new ParseUser(); 
user.setUsername(username); 
user.setPassword(password); 
user.setEmail(email); 

user.signUpInBackground(new SignUpCallback() { 
    public void done(ParseException e) { 
     if (e == null) { 
      // sign up succeeded so go to multiplayer screen 
      // store the username of the current player 
      currentUser = username; 
      final String title = "Account Created Successfully!"; 
      final String message = "Please verify your email before playing"; 
      buildAlertDialog(title, message, true); 
     } else { 
      // sign up didnt succed. //TODO: figure out how do deal with error 
      final String title = "Error Account Creation failed"; 
      final String message = "Account could not be created"; 
      buildAlertDialog(title, message, false); 
     } 
    } 
}); 
+0

我现在的代码不会将emailVerified设置为false。它现在只是空的 – James 2013-05-13 09:29:14

回答

4

转到您的parse.com主页上,前往设置,电子邮件设置,并在验证用户的电子邮件进行切换。

enter image description here

无需任何代码。

+0

谢谢你的回应!有用!我只是想知道你是否知道如何访问这个领域。我想要做一些像if(emailVerified) – James 2013-05-13 17:37:22

+3

我认为使用Android API它会像布尔值emailVerified = user.getBoolean(“emailVerified”); – Arcayne 2013-05-13 22:08:55