Can I get online users in my friend list via Smack?

后端 未结 5 506
自闭症患者
自闭症患者 2020-12-14 12:39

Can i get online users in my friend list via Smack API? Is it possible?

I am working on app which have chat between users. I had successfully created chat applicatio

5条回答
  •  清歌不尽
    2020-12-14 13:02

    smackAndroid = SmackAndroid.init(this);
    XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
    
        @Override
        public void connectionCreated(XMPPConnection connection) {
    
              Log.i("hello", "receive xmpp connection : " + connection);
              roster = connection.getRoster();
    
              try {
                  roster.createEntry("2868254", "hello", null);
              } catch (XMPPException e) {
                  e.printStackTrace();
              } catch (NotLoggedInException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (NoResponseException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (NotConnectedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
    });
    

提交回复
热议问题