In an Android application using Firebase, I need to execute long operations in background once Firebase returns a query answer. E.g.:
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot data) {
dosomething very long. . .
then call a callback forUI thread
}
I know that firebase execute the query in asynchronous mode but the onDataChange()
method seems to be always executed in the main UI Thread, even if I try to call the query in a custom background Thread.
Does anyone knows how to manage this use case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…