Hi,
I have firebase database Sales and I want to get the results of time range. Starting at 13:00:00 (1577278800000 as milliseconds) and end at 13:30:00 ( 1577280600000 as milliseconds )
Sales
-Lws9QiOnoc_lc0ECoYn
-total:
-time: 1577278800000
val rootRef = FirebaseDatabase.getInstance().reference
val query = rootRef.child("Sales").orderByChild("time").startAt(1577295000000).endAt(1577195256918)
//println("query1" +query1)
val valueEventListener = object : ValueEventListener {
override fun onDataChange(p0: DataSnapshot) {
if (p0.exists()) {
for(ds in p0.children) {
val timeList = arrayListOf<Long>()
val time = ds.child("time").getValue(Long::class.java)!!
timeList.add(time)
}
}
}
override fun onCancelled(databaseError: DatabaseError) {
Log.d(TAG, databaseError.getMessage()) //Don't ignore errors!
}
}
query.addListenerForSingleValueEvent(valueEventListener)
The thing is it is giving error when I try to run.
here is the error :
None of the following functions can be called with the arguments supplied:
@NonNull @PublicApi public open fun startAt(p0: Boolean): Query defined in com.google.firebase.database.Query
@NonNull @PublicApi public open fun startAt(p0: Double): Query defined in com.google.firebase.database.Query
@NonNull @PublicApi public open fun startAt(@Nullable p0: String?): Query defined in com.google.firebase.database.Query
startAt() taking Long as paramater and I have no idea why it is giving me this error.
Can anyone please help me here.