title: Getting list of all users registered on server with online/offline status using Smack API on android
body: <p>Im connecting to an ejabberd XMPP server using Smack API - </p>
  
  <pre><code>        username = "admin";
          password = "admin";
          port = "5222";
          serviceName = "davids-macbook-pro.local";
          host = "192.168.20.8";
  
       config = XMPPTCPConnectionConfiguration.builder()
                      .setUsernameAndPassword(username, password)
                      .setHost(host)
                      .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
                      .setServiceName(serviceName)
                      .setPort(Integer.parseInt(port))
                      .build();
  
              connection = new XMPPTCPConnection(config);
              try {
                  connection.connect();
                  connection.login();
              } catch (SmackException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              } catch (XMPPException e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>I want to get a list of all online users. How is it possible ?</p>
  
  <p>When I try - </p>
  
  <pre><code>Roster roster = Roster.getInstanceFor(connection);
  Collection&lt;RosterEntry&gt; entries = roster.getEntries();
  Log.i("entry", entries+"");
  for (RosterEntry entry : entries) {
  
  }
  </code></pre>
  
  <p>Getting a null array for</p>
  
  <pre><code>Collection&lt;RosterEntry&gt; entries = roster.getEntries();
  </code></pre>