mk-5 / gdx-fireapp

libGDX Firebase API
Apache License 2.0
63 stars 21 forks source link

onDataChange called receiving warning #3

Closed hermanghub closed 6 years ago

hermanghub commented 6 years ago

I've tried the readValue method and managed to retrieved the records on Firebase realtime database. Then I try to implement onDataChange with (MyClass.class, new DataChangeListener()) and override the onChange method.

When running my app, I saw below in Logcat: W/ClassMapper: No setter/field for xxxx found on class ...MyClass

and onChange is not called.

Please find the definition of MyClass as below: public class MyClass { public String initials; public String dateTime; public String remarks;

public MyClass() {}
public MyClass(String initials, String dateTime, String remarks) {
    this.initials = initials;
    this.dateTime = dateTime;
    this.remarks = remarks;
}

public String getInitials() {
    return initials;
}

public void setInitials(String initials) {
    this.initials = initials;
}

public String getDateTime() {
    return dateTime;
}

public void setDateTime(String dateTime) {
    this.dateTime = dateTime;
}

public String getRemarks() {
    return remarks;
}

public void setRemarks(String remarks) {
    this.remarks = remarks;
}

}

What have I done wrong or missing?

Also, what I really want to do is to maintain some sort of hall of fame records in Firebase database and display. How should I code to retrieve the 10 latest records from the database? or I need to wait for the next release for filtering/query feature?

Thanks in advance. Herman

mk-5 commented 6 years ago

Hi!

Unfortunately at this point is no way to get limited number of rows. You can try limit records by structure. Yes, support for filtering/querying will be here in next release - but at this moment i don't know when it will be - I hope at some point of February .

Can you put some sample code, how do you call GdxFireapp API?

hermangh commented 6 years ago

Please refer to the sample code I mentioned in #4. Thanks.

mk-5 commented 6 years ago

W/ClassMapper: No setter/field for xxxx found on class ... is throwing when there are some fields inside DB which your POJO does not cover by setters. Look here: https://firebase.google.com/support/guides/firebase-android#update_your_java_model_objects . GdxFireapp Api ignore unknown fields on ios, but i still working on it at android platform. I'll let you know here when I'm done - very soon

hermanghub commented 6 years ago

Thanks for the reference link. I'll study it. Thanks.

hermanghub commented 6 years ago

Recently used v1.3.1. The warning is gone on both Android and ios! Thanks anyway!