Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android应用程序中的xmpp发送和接收消息_Android_Xmpp - Fatal编程技术网

android应用程序中的xmpp发送和接收消息

android应用程序中的xmpp发送和接收消息,android,xmpp,Android,Xmpp,我正在开发一个短信应用程序。我可以使用sendMessage(“subject”、“to”)函数从我的应用程序发送消息;。我需要知道如何接收从另一端发送的消息。我需要获取这些数据并在我的应用程序中的textview中显示这些数据。我怎样才能做到这一点。我怎样才能做到这一点。请引导我 非常感谢。这将帮助您: PacketFilter filter = new MessageTypeFilter(Message.Type.chat); // Listener fo

我正在开发一个短信应用程序。我可以使用sendMessage(“subject”、“to”)函数从我的应用程序发送消息;。我需要知道如何接收从另一端发送的消息。我需要获取这些数据并在我的应用程序中的textview中显示这些数据。我怎样才能做到这一点。我怎样才能做到这一点。请引导我

非常感谢。

这将帮助您:

 PacketFilter filter = new MessageTypeFilter(Message.Type.chat);

                // Listener for incoming message from any user

                connection.addPacketListener(new PacketListener() {
                    public void processPacket(Packet packet) {
                        final Message message = (Message) packet;
                        if (message.getBody() != null) {
                            fromName = StringUtils.parseBareAddress(message
                                    .getFrom());
                            Log.i("XMPPClient", "Got text [" + message.getBody()
                                    + "] from [" + fromName + "]");     


                                    }
                                }
                            });

                        }
                    }
                }, filter);

我们可以使用BrodcastReceiver来处理消息接收吗??你能详细解释一下吗?谢谢你。