Reputation: 3
I have Add a button to my app . When i click the button the current time save to Sp. But i want to save this to my firebase database. How can i do this?
private void saveButtonClickTime() {
sp1.edit().putLong("mTime1", System.currentTimeMillis()).apply();
}
Upvotes: 0
Views: 1804
Reputation: 1957
Try This One. It will work .
private void saveButtonClickTime() {
sp1.edit().putLong("mTime1", System.currentTimeMillis()).apply();
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
rootRef.child("time").setValue(sp1);
}
Upvotes: 1