I want the auto generated key from firebase whenever i push data
<p>All the methods i have tried so far are only returning me the parents key and not the auto generated push key.</p>

<pre><code>String key = rootref.child("user").push().getKey();
newUser.setUid(key);
Log.i("#####",key);
Map&lt;String, Object&gt; childUpdates = new HashMap&lt;&gt;();
childUpdates.put(key,newUser);
rootref.updateChildren(childUpdates);
</code></pre>

<p>here the <code>getkey()</code> is returning "user" to me whereas i want the auto generated key.Prior to this i have tried using a child event listener and the <code>listenerforsinglevaluedevent</code> but even these gave the same output.Any help would be appreciated!!</p>