Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ec10da68
authored
Jun 05, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、优化点击返回按钮时应用的响应(现在会把进程杀掉避免其他异常)
2、开启定时重启功能
parent
1a73c3ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
+2
-0
app/src/main/java/com/bgycc/smartcanteen/utils/MonitorUtils.java
+5
-3
No files found.
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
View file @
ec10da68
...
...
@@ -400,6 +400,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
SCWebSocketClient
.
getInstance
().
realClose
();
SCTaskExecutor
.
getInstance
().
quit
();
MonitorUtils
.
stopMonitors
(
this
);
LogUtils
.
d
(
TAG
,
"MainActivity onDestroy,退出应用"
);
android
.
os
.
Process
.
killProcess
(
android
.
os
.
Process
.
myPid
());
}
private
void
initViews
()
{
...
...
app/src/main/java/com/bgycc/smartcanteen/utils/MonitorUtils.java
View file @
ec10da68
...
...
@@ -26,17 +26,19 @@ public class MonitorUtils {
private
static
final
int
LOG_REPEAT_INTERVAL
=
4
;
private
static
final
int
DATABASE_REPEAT_INTERVAL
=
12
;
// 每天早上指定时间重启设备
private
static
final
int
REBOOT_HOUR_OF_DAY
=
3
;
private
static
final
int
REBOOT_MIN
=
0
;
private
static
final
int
REBOOT_HOUR_OF_DAY
=
0
;
private
static
final
int
REBOOT_MIN
_OF_HOUR
=
1
;
public
static
void
startMonitors
(
Context
context
)
{
startLogFilesMonitor
(
context
);
startDatabaseMonitor
(
context
);
startRebootMonitor
(
context
);
}
public
static
void
stopMonitors
(
Context
context
)
{
stopLogFilesMonitor
(
context
);
stopDatabaseMonitor
(
context
);
stopRebootMonitor
(
context
);
}
// 指定时间重启设备
...
...
@@ -46,7 +48,7 @@ public class MonitorUtils {
Calendar
future
=
Calendar
.
getInstance
(
Locale
.
getDefault
());
future
.
add
(
Calendar
.
DAY_OF_YEAR
,
1
);
future
.
set
(
Calendar
.
HOUR_OF_DAY
,
REBOOT_HOUR_OF_DAY
);
future
.
set
(
Calendar
.
MINUTE
,
REBOOT_MIN
);
future
.
set
(
Calendar
.
MINUTE
,
REBOOT_MIN
_OF_HOUR
);
future
.
set
(
Calendar
.
SECOND
,
0
);
long
delay
=
future
.
getTimeInMillis
()
-
now
.
getTimeInMillis
();
LogUtils
.
d
(
TAG
,
delay
+
"毫秒后将重启设备"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment