Darshan Joshi
Darshan Joshi

Reputation: 111

retrieve values greater than particular value from firebase realtime databasein android

image

I have a local database in Android with some data that contains timestamp. And I have a firebase database that contains same data. Now if I update data in firebase database, suppose I update name and timestamp updated automatically. App also maintains last sync time in preference.

How do I retrieve all data from firebase where timestamp in firebase is greater than timestamp in preference ?

Upvotes: 8

Views: 4994

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598740

Something like this:

Query query = ref.orderByChild("lastUpdatedTimestamp").startAt("1490187991");

I'm not sure why you store the timestamp as a string btw. I recommend converting that to a number, so that you don't get caught when we reach the 11th digit (which admittedly will take quite some time).

Upvotes: 11

Related Questions