version:3.0.1_beta

update:2020.06.29
fix:修复在没网的时候anr
add:
This commit is contained in:
2020-06-29 18:30:18 +08:00
parent 12a26229a0
commit 32ea55c8e7
5 changed files with 28 additions and 28 deletions

View File

@@ -206,28 +206,27 @@ public class MyApplication extends MultiDexApplication {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.e("fht", "receiver action:" + action);
if (action.equals(Intent.ACTION_SCREEN_ON)
|| action.equals(Intent.ACTION_USER_PRESENT)
) {
time2 = System.currentTimeMillis();
if ((time2 - time1) > 60 * 1000) {
//可能会多次触发1分钟之内不执行
//application中启动服务,startcommand执行会两次
startService(new Intent(context, InitJpushServer.class));
startService(new Intent(context, StepService.class));
startService(new Intent(context, GuardService.class));
time1 = time2;
} else {
}
if (action.equals(Intent.ACTION_SCREEN_ON)) {
long time = System.currentTimeMillis();
getLockState("2", String.valueOf(time));
} else if (action.equals(Intent.ACTION_USER_PRESENT)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
time2 = System.currentTimeMillis();
if ((time2 - time1) > 60 * 1000) {
//可能会多次触发1分钟之内不执行
//application中启动服务,startcommand执行会两次
startService(new Intent(context, InitJpushServer.class));
startService(new Intent(context, StepService.class));
startService(new Intent(context, GuardService.class));
time1 = time2;
}
}
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
long time = System.currentTimeMillis();
getLockState("1", String.valueOf(time));
}
}
}
private void getLockState(String status, String time) {

View File

@@ -26,7 +26,7 @@ public class BootReceiver extends BroadcastReceiver {
|| intent.getAction().equals("android.intent.action.ACTION_POWER_CONNECTED")
|| intent.getAction().equals("android.intent.action.DATE_CHANGED")
|| intent.getAction().equals("android.intent.action.TIME_TICK")
// || intent.getAction().equals("android.intent.action.USER_PRESENT")
|| intent.getAction().equals("android.intent.action.USER_PRESENT")
|| intent.getAction().equals("android.intent.action.SCREEN_ON")
|| intent.getAction().equals("android.intent.action.SCREEN_OFF")
) {

View File

@@ -219,8 +219,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
return;
}
com.alibaba.fastjson.JSONObject extra = JSON.parseObject(extras);
String app_name=extra.getString("app_name");
String app_package=extra.getString("package");
String app_name = extra.getString("app_name");
String app_package = extra.getString("package");
String url = extra.getString("url");
int versionCode = extra.getInteger("version_code");
@@ -398,8 +398,10 @@ public class MyJPushReceiver extends BroadcastReceiver {
i++;
}
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + stringBuffer.toString());
String s = Settings.System.getString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes");//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes old" + s);
boolean b = Settings.System.putString(this.mContext.getContentResolver(), "qch_tfmedia_filetypes", stringBuffer.toString());//影音管控
Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + b + ":" + stringBuffer.toString());
} catch (JSONException e) {
Log.e("SystemSetting", "qch_tfmedia_filetypes---------" + e.getMessage());
@@ -906,7 +908,6 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
public void settingLock(String s) {
if (TextUtils.isEmpty(s)) {
Log.e("mjsheng", "settingLock extras is null");

View File

@@ -130,8 +130,8 @@ public class StepService extends Service {
public void onClose(int code, String reason, boolean remote) {
super.onClose(code, reason, remote);
Log.i("JWebSocketClientService", "websocket连接关闭");
client = null;
initSocketClient();
// client.close();
// initSocketClient();
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
}
@@ -140,8 +140,8 @@ public class StepService extends Service {
public void onError(Exception ex) {
super.onError(ex);
Log.i("JWebSocketClientService", "websocket连接错误");
client = null;
initSocketClient();
// client.close();
// initSocketClient();
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测
}