version:3.0.1_beta
update:2020.06.29 fix:修复在没网的时候anr add:
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user