use of com.avos.avoscloud.SaveCallback 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);
}
}
});
}
Aggregations