Create a server-side timer that updates the value in your database in real time.
Firebase ref = new Firebase('/firebase/database/url/time');
new AnimationTimer(){
start(){...}
stop(){...}
handle(){...ref.addValue(time);}
};
This will update your database in real time every milliseconds. To see this in your application, just call him.
Firebase ref = new Firebase('/firebase/database/url/time/value')
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot ds) {
Platform.runLater(() -> {
label.setText(ds.getValue() + "");
});
}
@Override
public void onCancelled(FirebaseError fe) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
. Java