在我的应用程序中,我需要做功能(正在打字...)概念。就像在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
}
});