Search in sources :

Example 1 with SaveCallback

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);
            }
        }
    });
}
Also used : SaveCallback(com.avos.avoscloud.SaveCallback) AVException(com.avos.avoscloud.AVException) AVObject(com.avos.avoscloud.AVObject)

Aggregations

AVException (com.avos.avoscloud.AVException)1 AVObject (com.avos.avoscloud.AVObject)1 SaveCallback (com.avos.avoscloud.SaveCallback)1