Firebase get push key string
1 answer
You can get a unique key after clicking the button
DatabaseReference newDatabaseReference = mDatabaseReference.child("loccheck").push();
newDatabaseReference.getKey();
or with setValue()
mDatabaseReference.child("loccheck")
.push()
.setValue(cloc, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(DatabaseError databaseError,
DatabaseReference databaseReference) {
String uniqueKey = databaseReference.getKey();
}
});
+1
source to share