Getting offline messages in android chat application with use of asmack library

前端 未结 6 1051
终归单人心
终归单人心 2021-02-11 04:12

I am using asmack library for my chat application.I am using below described code for getting messagecount:

ServiceDiscoveryManager manager = ServiceDiscoveryMan         


        
6条回答
  •  死守一世寂寞
    2021-02-11 05:06

    Try replacing your code with this.

    ProviderManager mgr = ProviderManager.getInstance();
    mgr.addExtensionProvider(offline, http://jabber.org/protocol/offline, org.jivesoftware.smackx.packet.OfflineMessageInfo$Provider);
    mgr.addIQProvider(offline, http://jabber.org/protocol/offline, org.jivesoftware.smackx.packet.OfflineMessageRequest$Provider);
    
    OfflineMessageManager offMgr = new OfflineMessageManager(connection);
    int numOffline = offMgr.getMessageCount();
    

提交回复
热议问题