use of com.avos.avoscloud.AVException in project AnimeTaste by daimajia.
the class SocialPlatform method saveInformation.
private void saveInformation(final Platform platform, boolean update, AVObject toUpdateobject) {
final AVObject object;
if (update) {
object = toUpdateobject;
} else {
object = new AVObject("Users");
}
object.setFetchWhenSave(true);
object.put("username", platform.getDb().getUserName());
object.put("avatar", platform.getDb().getUserIcon());
object.put("uid", platform.getDb().getUserId());
object.put("platform", platform.getName());
object.put("others", platform.getDb().exportData());
object.saveInBackground(new SaveCallback() {
@Override
public void done(AVException err) {
if (err == null) {
mSharedPreferences.edit().putString("objectid", object.getObjectId()).putString("username", platform.getDb().getUserName()).putString("avatar", platform.getDb().getUserIcon()).putString("uid", platform.getDb().getUserId()).putBoolean("login", true).putString("platform", platform.getName()).commit();
MobclickAgent.onEvent(mContext, "login");
mHandler.sendEmptyMessage(AUTH_SUCCESS);
} else {
mHandler.sendEmptyMessage(AUTH_SAVE_FAILED);
}
}
});
}
use of com.avos.avoscloud.AVException in project ride-read-android by Ride-Read.
the class RegisterFragment method verifyCode.
//验证验证码
private void verifyCode() {
EditText indentfyCodeEdt = (EditText) phoneNumView.findViewById(R.id.register_edt_identfycode);
String code = indentfyCodeEdt.getText().toString().trim();
if (!code.isEmpty()) {
AVOSCloud.verifySMSCodeInBackground(code, telPhone, new AVMobilePhoneVerifyCallback() {
@Override
public void done(AVException e) {
if (e == null) {
PreferenceUtils.getInstance().saveTelPhone(telPhone, getActivity().getApplicationContext());
changeView(phoneNumView, setPwdView);
} else {
Log.e("----->>>>", e.getMessage());
e.printStackTrace();
Toast.makeText(getActivity(), "验证码不匹配", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "未填写验证码", Toast.LENGTH_SHORT).show();
}
}
use of com.avos.avoscloud.AVException in project ride-read-android by Ride-Read.
the class RegisterFragment method onSendIdentCode.
//发送验证码
private void onSendIdentCode() {
EditText registerPhone = (EditText) phoneNumView.findViewById(R.id.register_edt_phone);
telPhone = registerPhone.getText().toString().trim();
if (telPhone != null && (!telPhone.isEmpty())) {
Log.i("手机号码:", telPhone);
AVOSCloud.requestSMSCodeInBackground(telPhone, "骑阅", "注册", 1, new RequestMobileCodeCallback() {
@Override
public void done(AVException e) {
if (e == null) {
new CountDownTimer(60000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
indentfyCodeTv.setText(millisUntilFinished / 1000 + "s后重新发送");
indentfyCodeTv.setClickable(false);
}
@Override
public void onFinish() {
indentfyCodeTv.setText("发送验证码");
indentfyCodeTv.setClickable(true);
}
}.start();
} else {
Toast.makeText(getActivity(), "验证码发送失败", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "未填手机号码", Toast.LENGTH_SHORT).show();
}
}
use of com.avos.avoscloud.AVException in project ride-read-android by Ride-Read.
the class LoginFragment method gotoFindPwd.
//跳转到找回密码
private void gotoFindPwd() {
EditText indentfyCodeEdt = (EditText) findPwdView.findViewById(R.id.register_edt_identfycode);
String code = indentfyCodeEdt.getText().toString().trim();
Log.e("----->>>>", code + "," + telPhone);
//startActivity(new Intent(FindPassword.this,RegisterSetPwdActivity.class));//下面的注释已经完成手机注册功能
if (!code.isEmpty()) {
AVOSCloud.verifySMSCodeInBackground(code, telPhone, new AVMobilePhoneVerifyCallback() {
@Override
public void done(AVException e) {
if (e == null) {
// Intent intent=new Intent(FindPassword.this,ResetPassword.class);
// intent.putExtra("telPhone",telPhone);
// startActivity(intent);
changeView(findPwdView, reSetPwdView);
} else {
Log.e("----->>>>", e.getMessage());
e.printStackTrace();
Toast.makeText(getActivity(), "验证码不匹配", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "未填写验证码", Toast.LENGTH_SHORT).show();
}
}
Aggregations