version:3.3.4
fix: update:修复无法安装
This commit is contained in:
1 parent
3dcd25b5bf
commit
9e15d20837
7 files changed
+31
-17
No files matched your search
@@ -143,13 +143,14 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
|
||||
case Intent.ACTION_USER_PRESENT:
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
mHandler.post(heartBeatRunnable);//开启心跳检测
|
||||
sendMsg(1);
|
||||
// sendMsg(1);
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
case Intent.ACTION_SHUTDOWN:
|
||||
case Intent.ACTION_FACTORY_RESET:
|
||||
case Intent.ACTION_MASTER_CLEAR:
|
||||
sendMsg(0);
|
||||
closeConnect();
|
||||
// sendMsg(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -171,7 +172,8 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
|
||||
* 初始化websocket连接
|
||||
*/
|
||||
private void initSocketClient() {
|
||||
URI uri = URI.create(BuildConfig.WEBSOCKET_URL);
|
||||
URI uri = URI.create("wss://as.fuyingy.com/wss/device?sn=" + Utils.getSerial());
|
||||
// URI uri = URI.create(BuildConfig.WEBSOCKET_URL);
|
||||
// URI uri = URI.create("ws://echo.websocket.org");
|
||||
// URI uri = URI.create("ws://123.207.136.134:9010/ajaxchattest");
|
||||
client = new JWebSocketClient(uri) {
|
||||
@@ -184,7 +186,8 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
|
||||
public void onOpen(ServerHandshake handshakedata) {
|
||||
super.onOpen(handshakedata);
|
||||
Log.i("JWebSocketClientService", "websocket连接成功");
|
||||
sendMsg(1);
|
||||
// sendMsg(1);
|
||||
sendMsg();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,19 +243,21 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus
|
||||
public void sendMsg() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
if (!pm.isScreenOn()) {
|
||||
jsonObject.addProperty("online", 0);
|
||||
//熄屏状态
|
||||
} else {
|
||||
jsonObject.addProperty("online", 1);
|
||||
}
|
||||
// PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
// if (!pm.isScreenOn()) {
|
||||
// jsonObject.addProperty("online", 0);
|
||||
// //熄屏状态
|
||||
// } else {
|
||||
// jsonObject.addProperty("online", 1);
|
||||
// }
|
||||
jsonObject.addProperty("type", "ping");
|
||||
if (null != client) {
|
||||
Log.i("JWebSocketClientService", "发送的消息:" + jsonObject.toString());
|
||||
client.send(jsonObject.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void sendMsg(int state) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
|
||||
Reference in new issue
Block a user