找到你要的答案

Q:How to perform different tasks based on server Message on android app?

Q:如何根据Android应用程序的服务器消息执行不同的任务?

I created working chat application in android and java based server using TCP/Ip . But now i want to perform tasks like vibration in phone when server send particular string such as "Vibrate" ... I tried if servermsg="Vibrate" (And called another class) but not working... Help Pls....

I created working chat application in android and java based server using TCP/Ip . But now i want to perform tasks like vibration in phone when server send particular string such as "Vibrate" ... I tried if servermsg="Vibrate" (And called another class) but not working... Help Pls....

answer1: 回答1:

i would start off by testing your logic to see where the issue is occuring.

for starters, you should print your server message to the console to see what is actually coming back. odds are that it's also wrapped in some kind of json object, so you'll probably need to parse the response also. if you can print the server response and then post it here we can have a read and help you resolve this.

我会先测试你的逻辑到哪里去的问题是存在的。

首先,您应该打印您的服务器消息到控制台,看看什么是实际回来。可能是,也裹着某种JSON对象,所以你可能需要解析的响应。如果您可以打印服务器响应,然后张贴在这里,我们可以有一个阅读,并帮助您解决这个。

java  android  tcp