如何通过服务器找到用户是否开始响应?[i.e.In 编辑他们是否键入的文本]

How to find the user is start responding or not at the other end via server?[ i.e.In edittext they typing or not]

本文关键字:是否 他们是 他们 编辑 In 文本 服务器 何通过 用户 开始 响应      更新时间:2023-09-26

在我的应用程序中,我需要做功能(正在打字...)概念。就像在WhatsApp中一样,如果用户开始响应其他用户,则表明用户正在键入。

同样,我需要找到另一端的用户是否开始响应。在whatsapp应用程序中,他们可能会使用一些先进的套接字概念XMPP的东西。我想用简单的php调用来做。是否有可能使用广播接收器和正常的API调用或建议我一些解决方案。谢谢

这样使用TextChangedListener

textMessage.addTextChangedListener(new TextWatcher(){
            public void afterTextChanged(Editable s) {
            }
            public void beforeTextChanged(CharSequence s, int start, int count, int after){}
            public void onTextChanged(CharSequence s, int start, int before, int count){
            // send a request like user is typing to your server and in your server pass this request to your other user
            }
    });