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
f2198266
authored
May 13, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保证启动时会清理掉上一次的任务
parent
c8a3b955
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
app/src/main/java/com/bgycc/smartcanteen/utils/WorkerUtils.java
+3
-0
No files found.
app/src/main/java/com/bgycc/smartcanteen/utils/WorkerUtils.java
View file @
f2198266
...
...
@@ -2,6 +2,7 @@ package com.bgycc.smartcanteen.utils;
import
android.content.Context
;
import
androidx.work.ExistingWorkPolicy
;
import
androidx.work.PeriodicWorkRequest
;
import
androidx.work.WorkManager
;
...
...
@@ -19,6 +20,7 @@ public class WorkerUtils {
// 每隔一定时间检查日志文件夹并进行清理
public
static
void
startLogFilesMonitor
(
Context
context
)
{
stopLogFilesMonitor
(
context
);
PeriodicWorkRequest
request
=
new
PeriodicWorkRequest
.
Builder
(
LogFileMonitor
.
class
,
LOG_REPEAT_INTERVAL
,
TimeUnit
.
HOURS
)
.
addTag
(
LOG_MONITOR_WORKER
)
.
build
();
...
...
@@ -33,6 +35,7 @@ public class WorkerUtils {
// 每隔一定时间检查数据库并进行清理
public
static
void
startDatabaseMonitor
(
Context
context
)
{
stopDatabaseMonitor
(
context
);
PeriodicWorkRequest
request
=
new
PeriodicWorkRequest
.
Builder
(
DatabaseMonitor
.
class
,
DATABASE_REPEAT_INTERVAL
,
TimeUnit
.
HOURS
)
.
addTag
(
DATABASE_MONITOR_WORKER
)
.
build
();
...
...
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