发送数据包时XMPP MessageEventManager错误?

时间:2014-09-20 15:32:25

标签: android xmpp smack asmack stream-management

当我发送MessageEventManager数据包时,我在返回stenza时发现错误

MessageEventManager.addNotificationsRequests(message, true, true, false, false);
            connection.sendPacket(message);

我已经实现了所有接口以接收与发送消息相关的所有确认包

喜欢

MessageEventManager eventManager=new MessageEventManager(connection);
            eventManager.addMessageEventNotificationListener(new MessageEventNotificationListener() {
                @Override
                public void offlineNotification(String from, String packetID) {


                }

                @Override
                public void displayedNotification(String from, String packetID) {
                    DriftUtilities.showLog("EventNotification displayedNotification==> "+from+packetID);
                }

                @Override
                public void deliveredNotification(String from, String packetID) {



                }

                @Override
                public void composingNotification(String from, String packetID) {
                    DriftUtilities.showLog("EventNotification composingNotification==> "+from+packetID);
                }

                @Override
                public void cancelledNotification(String from, String packetID) {

                }
            });

另一个界面

eventManager.addMessageEventRequestListener(new MessageEventRequestListener() {
                    @Override
                    public void offlineNotificationRequested(String from
                            , String packetID,
                            MessageEventManager messageEventManager) {
                        DriftUtilities.showLog("EventRequest offlineNotificationRequested==> "+from+packetID);
                    }

                    @Override
                    public void displayedNotificationRequested(String from
                            , String packetID,
                            MessageEventManager messageEventManager) {
                        DriftUtilities.showLog("EventRequest displayedNotificationRequested==> "+from+packetID);


                    }

                    @Override
                    public void deliveredNotificationRequested(String from
                            , String packetID,
                            MessageEventManager messageEventManager) {
                        DriftUtilities.showLog("EventRequest deliveredNotificationRequested==> "+from+packetID);

                        messageEventManager.sendDeliveredNotification(from, packetID);

                    }

                    @Override
                    public void composingNotificationRequested(String from
                            , String packetID,
                            MessageEventManager messageEventManager) {
                        DriftUtilities.showLog("EventRequest composingNotificationRequested==> "+from+packetID);
                    }
                });

1 个答案:

答案 0 :(得分:2)

@alpan,在连接到xmpp服务器时输入此代码。这是启用消息事件提供程序。

ProviderManager pm=ProviderManager.getInstance();
pm.addExtensionProvider("x","jabber:x:event", new MessageEventProvider());

这可能对你有所帮助。