本文整理匯總了Java中com.parse.ParseUser類的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser類的具體用法?Java ParseUser怎麽用?Java ParseUser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ParseUser類屬於com.parse包,在下文中一共展示了ParseUser類的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: verificarLogin
import com.parse.ParseUser; //導入依賴的package包/類
private void verificarLogin(String usuario, String senha) {
ParseUser.logInInBackground(usuario, senha, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (e == null) {//sucesso no login
Toast.makeText(LoginActivity.this, "Login realizado com sucesso!!", Toast.LENGTH_LONG).show();
abrirAreaPrincipal();
} else {//erro ao logar
ParseErros parseErros = new ParseErros();
String erro = parseErros.getErro(e.getCode());
Toast.makeText(LoginActivity.this, erro, Toast.LENGTH_LONG).show();
}
}
});
}
示例3: logIn
import com.parse.ParseUser; //導入依賴的package包/類
private void logIn() {
prefs = getSharedPreferences("prefFile", 0);
String userName = prefs.getString("userName",null);
String password = prefs.getString("password",null);
user.logInInBackground(userName, password, new LogInCallback() {
@Override
public void done(ParseUser parseUser, @Nullable ParseException e) {
if (e == null){
toaster("Login successful!","l");
}else {
toaster("Failed to connect!","l");
}
}
});
}
示例4: autoLogin
import com.parse.ParseUser; //導入依賴的package包/類
public void autoLogin(){
if (checkConnection()){
String userName = prefs.getString("userName",null);
String password = prefs.getString("password",null);
user.logInInBackground(userName, password, new LogInCallback() {
@Override
public void done(ParseUser parseUser, @Nullable ParseException e) {
if (e == null){
isLoggedIn = true;
splash(1500);
Snackbar.make(findViewById(R.id.activity_splash),"Login successful..",Snackbar.LENGTH_LONG).show();
}
}
});
}else {
isLoggedIn = false;
splash(4000);
Snackbar.make(findViewById(R.id.activity_splash),"You are offline, Working on local data",Snackbar.LENGTH_LONG).show();}
}
示例5: onCreate
import com.parse.ParseUser; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
ParseObject.registerSubclass(Kid.class);
ParseObject.registerSubclass(Visit.class);
ParseObject.registerSubclass(Attendance.class);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("PARSE applicationId to be added here")
.clientKey("Parse Client Id to be added here")
.server("Parse server address to be added here").enableLocalDataStore().build());
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
示例6: 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();
}
}
});
}
示例7: setUpParse
import com.parse.ParseUser; //導入依賴的package包/類
public static void setUpParse(Context context) {
Parse.enableLocalDatastore(context);
Parse.initialize(context, "SUA_APPLICATION_ID", "SUA CLIENT_KEY");
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParsePush.subscribeInBackground(Constants.CHANNEL, new SaveCallback() {
@Override
public void done(ParseException error) {
if (error == null) {
Log.i(Constants.TAG, "Successfully subscribed to Parse!");
}else{
Log.i(Constants.TAG, "Error subscribed to Parse!");
}
}
});
}
示例8: login
import com.parse.ParseUser; //導入依賴的package包/類
@Override
public void login(String username, String password) {
//Make sure parse is initialized in the Application class of the main app
ParseUser.logInInBackground(username, password,
new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (e == null){
//User exist and authenticated, send user to Welcome.class
EventBus.getDefault().post(new LoginCallbackEvent(true,null));
} else {
EventBus.getDefault().post(new LoginCallbackEvent(false, e.getMessage()));
}
}
});
}
示例9: getView
import com.parse.ParseUser; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View row=inflater.inflate(R.layout.list_single, parent, false);
TextView sos_title=(TextView) row.findViewById(R.id.name);
TextView sos_message=(TextView) row.findViewById(R.id.txt);
TextView sos_time=(TextView) row.findViewById(R.id.time);
//Log.d("Chatlist","view "+sos_list.get(position).getClassName());
final ParseUser user = sos_list.get(position).getParseUser("UserID");
user.pinInBackground();
sos_title.setText(user.getString("displayname"));
sos_message.setText(sos_list.get(position).getString("Description"));
sos_time.setText(DateFormater.formatTime(sos_list.get(position).getCreatedAt()));
CircleImageView iv1=(CircleImageView) row.findViewById(R.id.img);
iv1.setImageResource(R.drawable.sample_man);
Log.d("ChatList", "Pos " + position);
Helper.GetProfilePic(user, iv1, context);
Log.d("ChatList", "wow");
return row;
}
示例10: onCreate
import com.parse.ParseUser; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(this);
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
示例11: onOtherButtonClick
import com.parse.ParseUser; //導入依賴的package包/類
@Override
public void onOtherButtonClick(ActionSheet actionSheet, int index) {
switch (index) {
case 0:
startActivity(new Intent(this, GameTopActivity.class));
break;
case 1:
ParseUser.getCurrentUser().logOut();
MainApplication.socket.disconnect();
startActivity(new Intent(this, LoginActivty.class));
finish();
break;
case 2:
Toast.makeText(CommonActivity.this, "當前已是最新版本", Toast.LENGTH_SHORT).show();
break;
}
}
示例12: onCreate
import com.parse.ParseUser; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Button verifyPhoneLogin = (Button) findViewById(R.id.start_phone_login);
verifyPhoneLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
onPhoneLogin();
}
});
loginFormView = findViewById(R.id.login_form);
progressView = findViewById(R.id.login_progress);
// Log out any existing session
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
ParseUser.logOut();
}
}
示例13: signUp
import com.parse.ParseUser; //導入依賴的package包/類
public Observable<ParseUser> signUp(@NonNull String userName, @NonNull String password, @NonNull Map<String, ?> params) {
Log.d(TAG, "Running sign up");
return Observable.create(new SimpleParseRequest<ParseUser>("Exception while calling signUp") {
@NonNull
@Override
protected ParseUser networkCall() throws ParseException {
final ParseUser user = new ParseUser();
user.setUsername(userName);
user.setPassword(password);
for (Map.Entry<String, ?> param : params.entrySet()) {
user.put(param.getKey(), param.getValue());
}
user.signUp();
return user;
}
});
}
示例14: signIn
import com.parse.ParseUser; //導入依賴的package包/類
@Test
public void signIn() {
// Given
ParseUser currentUser = ModelTestHelper.createParseUser(USER_ID);
when(mParseHelper.signIn(USER_NAME, PASSWORD)).thenReturn(Observable.just(currentUser));
// When
TestSubscriber<BaseUser> testSubscriber = executeTarget(mTarget.signIn(new SessionQuery.SignIn(USER_NAME, PASSWORD)));
// Then
assertThat(testSubscriber.getOnNextEvents().size(), is(1));
BaseUser user = testSubscriber.getOnNextEvents().get(0);
assertEquals(USER_ID, user.getUserId());
testSubscriber.assertCompleted();
verify(mBroadcaster).userSignedIn();
}
示例15: register
import com.parse.ParseUser; //導入依賴的package包/類
@Test
public void register() {
// Given
ParseUser currentUser = ModelTestHelper.createParseUser(USER_ID);
when(mParseHelper.signUp(eq(USER_NAME), eq(PASSWORD), any())).thenReturn(Observable.just(currentUser));
// When
TestSubscriber<BaseUser> testSubscriber = executeTarget(mTarget.register(new SessionQuery.Register(USER_NAME, DISPLAY_NAME, PASSWORD)));
// Then
assertThat(testSubscriber.getOnNextEvents().size(), is(1));
BaseUser user = testSubscriber.getOnNextEvents().get(0);
assertEquals(USER_ID, user.getUserId());
testSubscriber.assertCompleted();
verify(mBroadcaster).userSignedIn();
}