Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- Roster roster = Roster.getInstanceFor(connection);
- Collection<RosterEntry> entries = roster.getEntries();
- Log.i("entry", entries+"");
- for (RosterEntry entry : entries) {
- }
- Collection<RosterEntry> entries = roster.getEntries();
- for (RosterEntry entry : entries) {
- HashMap<String, String> map = new HashMap<String,String>();
- Presence entryPresence = roster.getPresence(entry.getUser());
- Presence.Type type = entryPresence.getType();
- map.put("USER", entry.getName().toString());
- map.put("STATUS", type.toString());
- Log.e("USER", entry.getName().toString());
- usersList.add(map);
- }
- Roster roster = Roster.getInstanceFor(connection);
- Collection<RosterEntry> entries = roster.getEntries();
- for (RosterEntry rosterEntry : entries){
- System.out.println("xmpp.Roster.presence "+ roster.getPresence(rosterEntry.getUser()).getType());
- }
Add Comment
Please, Sign In to add comment