功能未实现asmack,Openfire

时间:2015-12-31 08:50:41

标签: android xmpp openfire asmack

我将Openfire 3.9.3与aSmack库一起使用 当我连接到聊天服务器时,我会不断收到以下日志 虽然我成功连接到服务器,可以使用我的应用程序聊天。

<button title="Void This Payment" value="TRUE" ...

我正在使用此代码设置xmpp连接

12-31 14:11:53.049: D/SMACK(4613): 02:11:53 PM RCV  (1101270208): <iq type="get" id="130-6586" from="nearbychat.com" to="1@nearbychat.com/Smack"><ping xmlns="urn:xmpp:ping"/></iq>

12-31 14:11:53.049: D/SMACK(4613): 02:11:53 PM SENT (1101270208): <iq id="130-6586" to="nearbychat.com" from="1@nearbychat.com/Smack" type="error"><error code="501" type="CANCEL"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

有人可以告诉我为什么我会反复拿到这个日志? 这些日志是否会影响我的应用程序性能,即:电池消耗?
我该怎么做才能摆脱这些日志?

2 个答案:

答案 0 :(得分:1)

public static void registerXmppProviders(){
        ProviderManager providerManager = ProviderManager.getInstance();
        providerManager.addIQProvider("query", "jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());
        ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
        ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
        ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
        // Time
        try {
            providerManager.addIQProvider("query", "jabber:iq:time",
                    Class.forName("org.jivesoftware.smackx.packet.Time"));
        } catch (ClassNotFoundException e) {
            Log.w("TestClient",
                    "Can't load class for org.jivesoftware.smackx.packet.Time");
        }
        //Pings
        providerManager.addIQProvider("ping","urn:xmpp:ping",new PingProvider());
        // Roster Exchange
        providerManager.addExtensionProvider("x", "jabber:x:roster", new RosterExchangeProvider());
        providerManager.addIQProvider("vCard", "vcard-temp", new VCardProvider());
        // Message Events
        providerManager.addExtensionProvider("x", "jabber:x:event",
                new MessageEventProvider());
        // Chat State
        providerManager.addExtensionProvider("active", "http://jabber.org/protocol/chatstates",
                new ChatStateExtension.Provider());
        providerManager.addExtensionProvider("composing", "http://jabber.org/protocol/chatstates",
                new ChatStateExtension.Provider());
        providerManager.addExtensionProvider("paused", "http://jabber.org/protocol/chatstates",
                new ChatStateExtension.Provider());
        providerManager.addExtensionProvider("inactive", "http://jabber.org/protocol/chatstates",
                new ChatStateExtension.Provider());
        providerManager.addExtensionProvider("gone", "http://jabber.org/protocol/chatstates",
                new ChatStateExtension.Provider());
        // XHTML
        providerManager.addExtensionProvider("html", "http://jabber.org/protocol/xhtml-im",
                new XHTMLExtensionProvider());
        // Group Chat Invitations
        providerManager.addExtensionProvider("x", "jabber:x:conference",
                new GroupChatInvitation.Provider());
        // Service Discovery # Items
        providerManager.addIQProvider("query", "http://jabber.org/protocol/disco#items",
                new DiscoverItemsProvider());
        // Service Discovery # Info
        providerManager.addIQProvider("query", "http://jabber.org/protocol/disco#info",
                new DiscoverInfoProvider());
        // Data Forms
        providerManager.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
        // MUC User
        providerManager.addExtensionProvider("x", "http://jabber.org/protocol/muc#user",
                new MUCUserProvider());
        // MUC Admin
        providerManager.addIQProvider("query", "http://jabber.org/protocol/muc#admin",
                new MUCAdminProvider());
        // MUC Owner
        providerManager.addIQProvider("query", "http://jabber.org/protocol/muc#owner",
                new MUCOwnerProvider());
        // Delayed Delivery
        providerManager.addExtensionProvider("x", "jabber:x:delay",
                new DelayInformationProvider());
        // Version
        try {
            providerManager.addIQProvider("query", "jabber:iq:version",
                    Class.forName("org.jivesoftware.smackx.packet.Version"));
        } catch (ClassNotFoundException e) {
            // Not sure what's happening here.
        }
        // VCard
        providerManager.addIQProvider("vCard", "vcard-temp", new VCardProvider());
        // Offline Message Requests
        providerManager.addIQProvider("offline", "http://jabber.org/protocol/offline",
                new OfflineMessageRequest.Provider());
        // Offline Message Indicator
        providerManager.addExtensionProvider("offline", "http://jabber.org/protocol/offline",
                new OfflineMessageInfo.Provider());
        // Last Activity
        providerManager.addIQProvider("query", "jabber:iq:last", new LastActivity.Provider());
        // User Search
        providerManager.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());
        // SharedGroupsInfo
        providerManager.addIQProvider("sharedgroup", "http://www.jivesoftware.org/protocol/sharedgroup",
                new SharedGroupsInfo.Provider());
        // JEP-33: Extended Stanza Addressing
        providerManager.addExtensionProvider("addresses", "http://jabber.org/protocol/address",
                new MultipleAddressesProvider());
        // FileTransfer
        providerManager.addIQProvider("si", "http://jabber.org/protocol/si",
                new StreamInitiationProvider());
        // Privacy
        providerManager.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());
        providerManager.addIQProvider("command", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider());
        providerManager.addExtensionProvider("malformed-action",
                "http://jabber.org/protocol/commands",
                new AdHocCommandDataProvider.MalformedActionError());
        providerManager.addExtensionProvider("bad-locale",
                "http://jabber.org/protocol/commands",
                new AdHocCommandDataProvider.BadLocaleError());
        providerManager.addExtensionProvider("bad-payload",
                "http://jabber.org/protocol/commands",
                new AdHocCommandDataProvider.BadPayloadError());
        providerManager.addExtensionProvider("bad-sessionid",
                "http://jabber.org/protocol/commands",
                new AdHocCommandDataProvider.BadSessionIDError());
        providerManager.addExtensionProvider("session-expired",
                "http://jabber.org/protocol/commands",
                new AdHocCommandDataProvider.SessionExpiredError());
        providerManager.addIQProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageRequest.Provider());
        //  Offline Message Indicator
        providerManager.addExtensionProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageInfo.Provider());
        providerManager.addIQProvider("query", "http://jabber.org/protocol/disco#info",
                new DiscoverInfoProvider());
        providerManager.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
        // pm.addExtensionProvider("status ","", new XMLPlayerList());
        providerManager.addIQProvider("query", "http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
        providerManager.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
        providerManager.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
}

答案 1 :(得分:0)

您可能必须在登录过程之前使用库本身提供的ProviderManager类注册所有提供程序。

希望这有效!