version:1.0.1
fix: update:去掉推送,增加退出和返回桌面,使用csdk获取sn
This commit is contained in:
@@ -27,6 +27,7 @@ import com.xuexispace.ai.activity.main.MainActivity;
|
||||
import com.xuexispace.ai.config.CommonConfig;
|
||||
import com.xuexispace.ai.manager.RemoteManager;
|
||||
import com.xuexispace.ai.utils.ActivationUtil;
|
||||
import com.xuexispace.ai.utils.LenovoCsdkUtil;
|
||||
import com.xuexispace.ai.utils.Utils;
|
||||
import com.xuexispace.ai.websocket.JWebSocketClient;
|
||||
|
||||
@@ -111,11 +112,12 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
registerScreenLockReceiver();
|
||||
registerJxwRegisterRefreshReceiver();
|
||||
|
||||
if (ActivationUtil.isActivation()) {
|
||||
if (ActivationUtil.getInstance().isActivation()) {
|
||||
//初始化websocket
|
||||
initSocketClient();
|
||||
startLoop();
|
||||
@@ -265,7 +267,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
Log.e("JxwRegisterReceiver", "onReceive: " + action);
|
||||
if (JXW_REGISTER_SUCCESS.equals(action)) {
|
||||
mMMKV.encode(JXW_REGISTER_SUCCESS, true);
|
||||
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, ActivationUtil.ACTIVATED_KEY);
|
||||
mMMKV.encode(CommonConfig.UIUI_ACTIVATION_KEY, ActivationUtil.getInstance().ACTIVATED_KEY);
|
||||
initSocketClient();
|
||||
startLoop();
|
||||
}
|
||||
@@ -292,7 +294,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
public void accept(Long s) throws Exception {
|
||||
Log.d(TAG, "startLoop accept: " + s);
|
||||
Log.i(TAG, "心跳包检测websocket连接状态");
|
||||
if (!ActivationUtil.isActivation()) {
|
||||
if (!ActivationUtil.getInstance().isActivation()) {
|
||||
dispose();
|
||||
}
|
||||
//每隔一定的时间,对长连接进行一次心跳检测
|
||||
@@ -320,7 +322,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
* 初始化websocket连接
|
||||
*/
|
||||
private void initSocketClient() {
|
||||
URI uri = URI.create(BuildConfig.WEBSOCKET_URL + "?sn=" + RemoteManager.getInstance().getSerial());
|
||||
URI uri = URI.create(BuildConfig.WEBSOCKET_URL + "?sn=" + LenovoCsdkUtil.getInstance().getSerial());
|
||||
mJWebSocketClient = new JWebSocketClient(uri) {
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
@@ -398,7 +400,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
*/
|
||||
public void sendPingMsg() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", RemoteManager.getInstance().getSerial());
|
||||
jsonObject.addProperty("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||
jsonObject.addProperty("type", "ping");
|
||||
if (null != mJWebSocketClient) {
|
||||
Log.i(TAG, "sendPingMsg: 发送的消息:" + jsonObject.toString());
|
||||
@@ -408,7 +410,7 @@ public class SocketService extends Service implements NetworkUtils.OnNetworkStat
|
||||
|
||||
public void sendMsgScreen() {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("sn", RemoteManager.getInstance().getSerial());
|
||||
jsonObject.addProperty("sn", LenovoCsdkUtil.getInstance().getSerial());
|
||||
if (Utils.isScreenOn(SocketService.this)) {
|
||||
jsonObject.addProperty("type", "device_open_screen");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user