Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

Getting all the users from openfire server using smack in android

$
0
0

i have a openfire server running on my localhost and i am successfully able to send and receive messages to registered users. however i am not been able to get all users from server. i am logged in with user that doesn't have a administration access. so do i need to give any permission on server side?

The code i am using for getting all users is..

 

if( xmpp.getConnection()==null||!xmpp.getConnection().isConnected())
  
return;

  
try{
  
UserSearchManager usm =newUserSearchManager(xmpp.getConnection());
  
Form searchForm = usm.getSearchForm("search."+ xmpp.getConnection().getServiceName());
  
Form answerForm = searchForm.createAnswerForm();
  
UserSearch userSearch =newUserSearch();
  answerForm
.setAnswer("Username",true);
  answerForm
.setAnswer("search", userName);
  
ReportedData data = userSearch.sendSearchForm(xmpp.getConnection(), answerForm,"search."+ xmpp.getConnection().getServiceName());

  
for(ReportedData.Row row : data.getRows())
  
{
  arrayList
.add(row.getValues("Username").toString());
  
}
  
}catch(Exception e){
  e
.printStackTrace();
  
}

 

i tried some solutions that shows to use Roster class, however that is also not helping me. Can anyone show what i am doing wrong or if i need to give any permission as i am not logged in as admin?

Thanks


Viewing all articles
Browse latest Browse all 4979

Trending Articles