本文整理匯總了Java中com.parse.ParseUser.signUpInBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser.signUpInBackground方法的具體用法?Java ParseUser.signUpInBackground怎麽用?Java ParseUser.signUpInBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.signUpInBackground方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cadastrarUsuario
import com.parse.ParseUser; //導入方法依賴的package包/類
private void cadastrarUsuario() {
//Cria objeto usuario
ParseUser usuario = new ParseUser();
usuario.setUsername(textoUsuario.getText().toString());
usuario.setEmail(textoEmail.getText().toString());
usuario.setPassword(textoSenha.getText().toString());
//salva dados do usuario
usuario.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {//sucesso ao salvar
Toast.makeText(CadastroActivity.this, "Cadastro feito com sucesso!",
Toast.LENGTH_LONG).show();
abrirLoginUsuario();
} else {//erro ao salvar
ParseErros parseErros = new ParseErros();
String erro = parseErros.getErro(e.getCode());
Toast.makeText(CadastroActivity.this, erro, Toast.LENGTH_LONG).show();
}
}
});
}
示例2: signUp
import com.parse.ParseUser; //導入方法依賴的package包/類
private void signUp(){
ParseUser user = new ParseUser();
user.setUsername(USER_NAME);
user.setPassword(PASSWORD);
user.setEmail(EMAIL);
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
login();
Toast.makeText(getApplicationContext(), "Login cadastrado com sucesso", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), "Erro ao cadastrar login", Toast.LENGTH_SHORT).show();
}
}
});
}
示例3: registerOnClick
import com.parse.ParseUser; //導入方法依賴的package包/類
public void registerOnClick(View v) {
name = userName.getText().toString();
pass = password.getText().toString();
mail = Mail.getText().toString();
if(name.length() < 4 || pass.length() < 6 || mail.length() == 0)
System.out.println("Something has fucked up");
final ParseUser user = new ParseUser();
user.setUsername(name);
user.setEmail(mail);
user.setPassword(pass);
System.out.println("Request sent");
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
System.out.println("Got Response");
if(e == null) {
startActivity(new Intent(Register.this, UserList.class));
}
else e.printStackTrace();
}
});
}
示例4: connectToParse
import com.parse.ParseUser; //導入方法依賴的package包/類
public void connectToParse(){
Profiles profiles = Profiles.getInstance();
String loginUser = profiles.loginEmail.replace("@ualberta.ca", "");
//create new user
ParseUser userParse = new ParseUser();
userParse.setUsername(loginUser);
userParse.setPassword(loginUser);
userParse.setEmail(profiles.loginEmail);
userParse.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
// Hooray! Let them use the app now.
initiateParse();
startApp();
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
login();
}
}
});
}
示例5: signup
import com.parse.ParseUser; //導入方法依賴的package包/類
private void signup(String usernametxt, String passwordtxt) {
if (!isEmpty()){
int numberParse = 0;
ParseQuery<ParseUser> numberofUsers = ParseUser.getQuery(); // Note to myself : count users in parse class
try {
numberParse=numberofUsers.count();
} catch (ParseException e1) {
e1.printStackTrace();
}
user = new ParseUser();
user.setUsername(usernametxt);
user.setPassword(passwordtxt);
user.put("userID",numberParse+1);
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
checkSignup(e);
}
});
}
}
示例6: create
import com.parse.ParseUser; //導入方法依賴的package包/類
public void create(User user) {
Log.d("User", "start method create in UserCRUD");
ParseUser usr = new ParseUser();
usr.put(USERNAME, user.getUsername());
usr.put(PASSWORD, user.getPassword());
usr.put(EMAIL, user.getEmail());
Log.d("User", user.getUsername());
usr.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Log.d("User", "h send empty message");
handler.sendEmptyMessage(CONNECTION_OK);
Log.d("User", "h = 1");
} else {
handler.sendEmptyMessage(0);
Log.d("User", "exception" + e.toString());
}
}
});
}
示例7: createAccount
import com.parse.ParseUser; //導入方法依賴的package包/類
@OnClick(R.id.saveNewAccount) void createAccount(View view) {
ParseUser parseUser = new ParseUser();
parseUser.setUsername(newUser.getText().toString());
parseUser.setEmail(newUser.getText().toString());
parseUser.setPassword(newPassword.getText().toString());
parseUser.put(Constants.PARSE_USER_ATTR_NAME, newName.getText().toString().trim());
parseUser.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
// Hooray! Let them use the app now.
Log.e(LOG_TAG, "Hooray! Let them use the app now");
Toast.makeText(getApplicationContext(), "Hooray! Let them use the app now", Toast.LENGTH_SHORT).show();
handleAccountCreated();
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
Log.e(LOG_TAG, "Sign up didn't succeed. Look at the ParseException");
Toast.makeText(getApplicationContext(), "Sign up didn't succeed. Look at the ParseException", Toast.LENGTH_SHORT).show();
}
}
});
}
示例8: createUser
import com.parse.ParseUser; //導入方法依賴的package包/類
@OnClick(R.id.createAccountButton) void createUser(View view){
ParseUser parseUser = new ParseUser();
parseUser.setUsername(personName.getText().toString());
parseUser.setEmail(email.getText().toString());
parseUser.setPassword(password.getText().toString());
parseUser.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
// Hooray! Let them use the app now.
Log.e(LOG_TAG, "Hooray! Let them use the app now");
Toast.makeText(getApplicationContext(), "Hooray! Let them use the app now", Toast.LENGTH_SHORT).show();
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
Log.e(LOG_TAG, "Sign up didn't succeed. Look at the ParseException");
Toast.makeText(getApplicationContext(), "Sign up didn't succeed. Look at the ParseException", Toast.LENGTH_SHORT).show();
}
}
});
}
示例9: signUpInBackground
import com.parse.ParseUser; //導入方法依賴的package包/類
public void signUpInBackground(ParseUser user){
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
EventBus.getDefault().post(new RegisterCallbackEvent(true,null));
} else {
EventBus.getDefault().post(new RegisterCallbackEvent(true,e.getMessage()));
}
}
});
}
示例10: signup
import com.parse.ParseUser; //導入方法依賴的package包/類
/**
* Creates a new user in the Parse backend using the provided credentials
*
* @param teamNumber the team number to signup to
* @param email the email of the user
* @param pass the password of the user account
*/
public void signup(final String teamNumber, final String email, String pass, final View view) {
if (!isNetworkAvailable()) {
Snackbar.make(view, "Unable to connect to the Internet. Try again.", Snackbar.LENGTH_SHORT).show();
return;
}
// Make sure all fields are filled in
if (teamNumber.equals("") || email.equals("") || pass.equals("")) {
Snackbar.make(view, "Please fill in all fields.", Snackbar.LENGTH_SHORT).show();
return;
}
// Create new ParseUser object to signup with field credentials
ParseUser user = new ParseUser();
user.setEmail(email);
user.setUsername(email);
user.setPassword(pass);
user.put("Team", teamNumber);
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
// Signup was successful, no exception
if (e == null) {
Snackbar.make(view, "Successfully signed up.", Snackbar.LENGTH_SHORT).show();
sessionManager.createLoginSession(teamNumber, email);
startActivity(new Intent(getApplicationContext(), TeamListActivity.class));
finish();
} else {
Snackbar.make(view, "Unable signed up. Please try again.", Snackbar.LENGTH_SHORT).show();
password.setText("");
passwordAgain.setText("");
}
}
});
}
示例11: signup
import com.parse.ParseUser; //導入方法依賴的package包/類
public void signup() {
final Intent myintent = new Intent(getActivity(),HomePage.class);
if (!name.getText().toString().isEmpty() && !email.getText().toString().isEmpty() && !pass.getText().toString().isEmpty() && !repass.getText().toString().isEmpty() && pass.getText().toString().equals(repass.getText().toString()) && pass.getText().toString().length() >= 6)
{
ParseUser user = new ParseUser();
user.setUsername(email.getText().toString());
user.setPassword(pass.getText().toString());
user.setEmail(email.getText().toString());
user.put("Name",name.getText().toString());
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
showSuccess("Please verify your email, then click the login button");
firebaseSignUp(email.getText().toString());
} else {
showIssue(e.toString());
}
}
});
}else if (name.getText().toString().isEmpty() || email.getText().toString().isEmpty() || pass.getText().toString().isEmpty() || repass.getText().toString().isEmpty()){
showIssue("Please makes sure you fill out all the fields properly!");
}else if(!pass.getText().toString().equals(repass.getText().toString())){
showIssue("Oops your passwords do not match, please try again");
}else if(pass.getText().toString().length()<6){
showIssue("Please make sure your password is at least six characters long");
}
}
示例12: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public void onCreate() {
Parse.initialize(this, "8FttRlqaAUPabxXzuLeTMbmgAA389L7oVbFaSqjj", "6sFwktakiPYSDg1NKzgP18yanSjlB9CQKFGUOShs");
// Also in this method, specify a default Activity to handle push notifications
PushService.setDefaultPushCallback(this, Notification.class);
// PushService.subscribe(this, "Everyone", Notification.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseObject.registerSubclass(Message.class);
// ParsePush.subscribeInBackground("Giants");
ParseUser user = new ParseUser();
user.setUsername("caip");
user.setPassword("piacpiac");
user.setEmail("[email protected]");
ParseUser user_2 = new ParseUser();
user_2.setUsername("professor");
user_2.setPassword("prof_iprj");
user_2.setEmail("[email protected]");
user.signUpInBackground(new SignUpCallback() {
@Override
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
}
}
});
}
示例13: onClick
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if(!validate()){
return;
}
// Check if password match
final String password = passwordField.getText().toString();
if(!password.equals(confirmPasswordField.getText().toString())){
confirmPasswordField.setError(MyApp.getAppContext().getString(R.string.passwordNotMatch));
confirmPasswordField.setText("");
confirmPasswordField.requestFocus();
return;
}
String username = usernameField.getText().toString();
String email = emailField.getText().toString();
ParseUser user = new ParseUser();
// Set standard fields
user.setUsername(username);
user.setPassword(password);
user.setEmail(email);
loadingStart();
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (isActivityDestroyed()) {
return;
}
if (e == null) {
loadingFinish();
signupSuccess();
} else {
loadingFinish();
switch (e.getCode()) {
case ParseException.INVALID_EMAIL_ADDRESS:
showToast(R.string.invalidEmail);
break;
case ParseException.USERNAME_TAKEN:
showToast(R.string.usernameTaken);
break;
case ParseException.EMAIL_TAKEN:
showToast(R.string.emailTaken);
break;
default:
showToast(R.string.unknownSignupError);
}
}
}
});
}
示例14: clearFocusAndSubmit
import com.parse.ParseUser; //導入方法依賴的package包/類
private void clearFocusAndSubmit() {
View focussedView = getView().findFocus();
if (focussedView != null) focussedView.clearFocus();
List<String> validationErrors = new ArrayList<>();
//boolean passwordsOK = !StringUtils.isAnyNullOrEmpty(mPassword1) && mPassword1.length()>0;
//if(!passwordsOK) validationErrors.add("Passwords do not match");
final ParseUser parseUser = new ParseUser();
if (mCustomer.password==null || mCustomer.password.length()<CustomerHelper.MIN_PASSWORD_LENGTH)
validationErrors.add(String.format("A valid password is required of at least %d characters", CustomerHelper.MIN_PASSWORD_LENGTH));
else parseUser.setPassword(mCustomer.password);
String email = mCustomer.getEmail();
if(email!=null) {
parseUser.setEmail(email);
parseUser.setUsername(email);
}
parseUser.put("firstName", mCustomer.firstName);
parseUser.put("lastName", mCustomer.lastName);
validationErrors.addAll(CustomerHelper.validate(parseUser));
if(validationErrors.size()>0){
aq.id(R.id.validation).text(StringUtils.stringListToString(validationErrors, "\n", false));
}
else{
requestingCount=1;
onRequestingChanged();
aq.id(R.id.validation).text("");
parseUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
requestingCount=0;
onRequestingChanged();
if (e != null) {
new AlertDialog.Builder(getActivity()).setMessage(e.getMessage()).setPositiveButton(R.string.ok, null).show();
} else {
if (ConnectedApp.DEBUG)
Toast.makeText(getActivity(), "Signup success", Toast.LENGTH_SHORT).show();
Session.getInstance().setCustomerHeader(parseUser, mCustomer.password);
// Intent intent = new Intent(getActivity(), PreferencesActivity.class);
// startActivity(intent);
// getActivity().finish();
}
}
});
}
}
示例15: signup
import com.parse.ParseUser; //導入方法依賴的package包/類
private void signup() {
String username = usernameEditText.getText().toString().trim();
String password = passwordEditText.getText().toString().trim();
String passwordAgain = passwordAgainEditText.getText().toString().trim();
// Validate the sign up data
boolean validationError = false;
StringBuilder validationErrorMessage = new StringBuilder(getString(R.string.error_intro));
if (username.length() == 0) {
validationError = true;
validationErrorMessage.append(getString(R.string.error_blank_username));
}
if (password.length() == 0) {
if (validationError) {
validationErrorMessage.append(getString(R.string.error_join));
}
validationError = true;
validationErrorMessage.append(getString(R.string.error_blank_password));
}
if (!password.equals(passwordAgain)) {
if (validationError) {
validationErrorMessage.append(getString(R.string.error_join));
}
validationError = true;
validationErrorMessage.append(getString(R.string.error_mismatched_passwords));
}
validationErrorMessage.append(getString(R.string.error_end));
// If there is a validation error, display the error
if (validationError) {
Toast.makeText(SignUpActivity.this, validationErrorMessage.toString(), Toast.LENGTH_LONG)
.show();
return;
}
// Set up a progress dialog
final ProgressDialog dialog = new ProgressDialog(SignUpActivity.this);
dialog.setMessage(getString(R.string.progress_signup));
dialog.show();
// Set up a new Parse user
ParseUser user = new ParseUser();
user.setUsername(username);
user.setPassword(password);
// Call the Parse signup method
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
dialog.dismiss();
if (e != null) {
// Show the error message
Toast.makeText(SignUpActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
} else {
// Start an intent for the dispatch activity
Intent intent = new Intent(SignUpActivity.this, DispatchActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
});
}