android - Can not update user information & ParseCloud.callFunction() missing User information -


whenever call these query, can't update user information & parsecloud.callfunctioninbackground() missing user information (request.user in cloud function null)!

query#1

((user) parseuser.getcurrentuser())         .getchats()         .getquery()         .include(chat_teacher1)         .include(chat_student1)         .findinbackground(); 

query#2

parsequery.getquery(rate.class)         .include(rate_rater)         .include(rate_rateto)         .include(rate_lesson)         .whereequalto(rate_rater, parseuser.getcurrentuser())         .whereequalto(rate_rated, false)         .findinbackground(); 

query#3

parsequery.getquery(message.class)         .include(message_from)         .include(message_lesson)         .whereequalto(message_chat, parseobject.createwithoutdata(chat.class, chatid))         .orderbydescending(message_order)         .setlimit(message_per_page)         .setskip(message_per_page * page)         .findinbackground(); 

common stuff of these 3 queries of query includes currentuser(). means of query returns list of each object has relationship user , currentuser can included in these query.

here model settings. user

@parseclassname("_user") public class user extends parseuser {      public string getfullname() {         return getstring(user_fullname);     }      public void setfullname(@nonnull string string) {         put(user_fullname, string);         eventbus.getinstance().post(new redrawsettingsviewevent());     }      public date getbirthday() {         return getdate(user_birthday);     }      public void setbirthday(@nonnull date date) {         put(user_birthday, date);         eventbus.getinstance().post(new redrawsettingsviewevent());     }      public gender getgender() {         return gender.fromstring(getstring(user_gender));     }      public void setgender(@nonnull gender gender) {         put(user_gender, gender.tostring());     }      public membertype getmembertype() {         return membertype.fromstring(getstring(user_member_type));     }      public void setmembertype(@nonnull membertype membertype) {         put(user_member_type, membertype.tostring());     }      public number getpricemin() {         return getnumber(user_price_min);     }      public void setpricemin(int integer) {         if (integer < 0 || integer > 200)             throw new runtimeexception("price validation error");          put(user_price_min, integer);     }      public list<language> getlanguages() {         return (list<language>) get(user_languages);     }      public void setlanguages(list<language> languages) {         put(user_languages, languages);     }      public language getlanguageof(languagelevel languagelevel) {         list<language> = getlanguages();         if (languagelevel == null || == null)             return null;          (language language : all)             if (languagelevel == language.getlanguagelevel())                 return language;          return null;     }      public list<language> getspeakings() {         list<language> others = new arraylist<>();         list<language> = getlanguages();         if (all == null)             return others;          (language language : all)             if (language.getlanguagelevel().getlanguagetype() == languagelevel.languagetype.speaking)                 others.add(language);          return others;     }      public parserelation<chat> getchats() {         return getrelation(user_chats);     }      public parserelation<rate> getrates() {         return getrelation(user_rates);     }      public void savepineventually() {         saveeventually();         pininbackground();     }      public void savepineventually(@nonnull savecallback savecallback) {         saveeventually();         pininbackground(savecallback);     }      public void savepininbackground() {         saveinbackground();         pininbackground();     }      public void savepininbackground(@nonnull final savecallback savecallback) {         saveinbackground();         pininbackground(new savecallback() {             @override             public void done(parseexception e) {                 if (e == null) {                     saveinbackground(savecallback);                 } else {                     savecallback.done(e);                 }             }         });     } } 

rate

@parseclassname("rate") public class rate extends parseobject {      public number getrate() {         return getnumber(rate_rate);     }      public void setrate(float rate) {         put(rate_rate, rate);     }      public user getrater() {         return (user) getparseuser(rate_rater);     }      public void setrater(user rater) {         put(rate_rater, rater);     }      public user getrateto() {         return (user) getparseuser(rate_rateto);     }      public void setrateto(user rateto) {         put(rate_rateto, rateto);     }      public lesson getlesson() {         return (lesson) getparseobject(rate_lesson);     }      public void setlesson(lesson lesson) {         put(rate_lesson, lesson);     }      public boolean getrated() {         return getboolean(rate_rated);     }      public void setrated(boolean rated) {         put(rate_rated, rated);     } }  @parseclassname("chat") public class chat extends parseobject {      public int getnumberofchatter() {         number counter = getnumber(chat_number_of_chatter);         return counter == null ? 0 : counter.intvalue();     }      public void setnumberofchatter(int number) {         put(chat_number_of_chatter, number);     }      public user getteacher1() {         return (user) getparseuser(chat_teacher1);     }      public void setteacher1(user user) {         put(chat_teacher1, user);     }      public user getstudent1() {         return (user) getparseuser(chat_student1);     }      public void setstudent1(user user) {         put(chat_student1, user);     }      public date getorder() {         date order = getdate(chat_order);         if (order != null)             return order;         else             return getcreatedat();     }      public void updateorder() {         put(chat_order, new date());     } } 

message

@parseclassname("message") public class message extends parseobject {      public chat getchat() {         return (chat) getparseobject(message_chat);     }      public void setchat(chat chat) {         put(message_chat, chat);     }      public messagetype gettype() {         return messagetype.fromstring(getstring(message_type));     }      public void settype(@nonnull messagetype messagetype) {         put(message_type, messagetype.tostring());     }      public user getfrom() {         return (user) getparseobject(message_from);     }      public void setfrom(user user) {         put(message_from, user);     }      public string gettext() {         return getstring(message_text);     }      public void settext(string text) {         put(message_text, text);     }      public lesson getlesson() {         return (lesson) getparseobject(message_lesson);     }      public void setlesson(lesson lesson) {         put(message_lesson, lesson);     }      public date getorder() {         date order = getdate(message_order);         if (order != null)             return order;         else if (getcreatedat() != null)             return getcreatedat();         else             return new date();     }      public void setorder(date order) {         put(message_order, order);     } } 

here application settings

public class baseapplication extends application {      @override     public void oncreate() {         super.oncreate();          parse.setloglevel(parse.log_level_verbose);          parseobject.registersubclass(user.class);         parseobject.registersubclass(language.class);         parseobject.registersubclass(chat.class);         parseobject.registersubclass(message.class);         parseobject.registersubclass(lesson.class);         parseobject.registersubclass(payment.class);         parseobject.registersubclass(payout.class);         parseobject.registersubclass(rate.class);          parse.enablelocaldatastore(this);         parse.initialize(this, "xxxx", "xxxx");          parseacl defaultacl = new parseacl();         defaultacl.setpublicreadaccess(true);         defaultacl.setpublicwriteaccess(true);         parseacl.setdefaultacl(defaultacl, false);          parsefacebookutils.initialize(this);         parseinstallation.getcurrentinstallation().saveinbackground();     } } 

cloud code

parse.cloud.define('globeefeed', function(request, response) {     // check whether user logged in    var user = request.user;    if (!user)       return errors.alert(response, null, 'globee feed', 'user not yet logged in.');     // request.params    // request.params.languagecode    // request.params.male    // request.params.female    // request.params.pricemin    // request.params.pricemax    // request.params.distance    // request.params.latitude    // request.params.longitude    // request.params.seed    // request.params.page    // request.params.itemperpage     // check whether parameters valid    if (!request.params       || !request.params.languagecode       || typeof request.params.male === typeof undefined       || typeof request.params.female === typeof undefined       || !request.params.pricemin === typeof undefined       || !request.params.pricemax === typeof undefined       || !request.params.distance === typeof undefined       || !request.params.seed === typeof undefined       || !request.params.page === typeof undefined)       return errors.log(response, null, 'globee feed', 'not enough parameters.'); } 

the request.user null!

this not problem , found code making problem. if include _user class, somehow user messed inside (using localdatastore) , user information lost.

this happens
1. open app
2. app calls query includes _user class
3. close app , re-open it
4. user information lost , cloud code says request.user null , can't edit current user (saveinbackground says error null not saved in parse server)

problem parse-1.9.2 also. data doesn't lost query slow , phone give me anr @ point.

i'm using parse-1.9.4, bolt-1.2.0.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -