Here is my simple query for firebase data using timestamp in an android application.
Query recentStaticJobQuery = reference.child(AppConstants.WORKINDIA_JOBS) .child(AppConstants.WORKINDIA_STATIC_JOBS) .orderByChild(AppConstants.TIMESTAMP) .startAt(lastStaticJobSyncTime); recentStaticJobQuery.addListenerForSingleValueEvent (staticJobDownloadListener); ValueEventListener staticJobDownloadListener = new ValueEventListener() { @Override public void onDataChange(final DataSnapshot dataSnapshot) { Log.i("Firebase", "Called") } @Override public void onCancelled(DatabaseError databaseError) { Log.i("Firebase", "onCancelled") } };
How to avoid onDataChange to call twice in android Firebase?
source share