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
5cf16966
authored
Mar 16, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日志、下载APP路径到SD卡
parent
480ad683
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
app/src/main/java/com/bgycc/smartcanteen/RootApp.java
+5
-2
app/src/main/java/com/bgycc/smartcanteen/command/UpdateCommandHandler.java
+2
-1
daemon/src/main/java/com/bgycc/smartcanteen/daemon/ServiceApplication.java
+14
-0
No files found.
app/src/main/java/com/bgycc/smartcanteen/RootApp.java
View file @
5cf16966
...
@@ -4,22 +4,25 @@ import android.app.Application;
...
@@ -4,22 +4,25 @@ import android.app.Application;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.Utils
;
import
com.blankj.utilcode.util.Utils
;
import
java.io.File
;
import
java.io.File
;
public
class
RootApp
extends
Application
{
public
class
RootApp
extends
Application
{
private
static
final
String
LOG_PREFIX
=
"app"
;
private
static
final
String
LOG_DIR
=
"log"
;
private
static
final
String
LOG_DIR
=
"log"
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
Utils
.
init
(
getApplicationContext
());
Utils
.
init
(
getApplicationContext
());
String
logDir
=
getApplicationContext
().
getFilesDir
().
getAbsolut
ePath
()
+
File
.
separator
+
LOG_DIR
;
String
logDir
=
PathUtils
.
getExternalStorag
ePath
()
+
File
.
separator
+
LOG_DIR
;
CrashUtils
.
init
(
logDir
);
CrashUtils
.
init
(
logDir
);
LogUtils
.
getConfig
()
LogUtils
.
getConfig
()
.
setDir
(
logDir
)
.
setDir
(
logDir
)
.
setLog2FileSwitch
(
true
)
.
setLog2FileSwitch
(
true
)
.
setBorderSwitch
(
false
);
.
setBorderSwitch
(
false
)
.
setFilePrefix
(
LOG_PREFIX
);
}
}
}
}
app/src/main/java/com/bgycc/smartcanteen/command/UpdateCommandHandler.java
View file @
5cf16966
...
@@ -11,6 +11,7 @@ import com.blankj.utilcode.util.AppUtils;
...
@@ -11,6 +11,7 @@ import com.blankj.utilcode.util.AppUtils;
import
com.blankj.utilcode.util.FileIOUtils
;
import
com.blankj.utilcode.util.FileIOUtils
;
import
com.blankj.utilcode.util.FileUtils
;
import
com.blankj.utilcode.util.FileUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.Utils
;
import
com.blankj.utilcode.util.Utils
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -78,7 +79,7 @@ public class UpdateCommandHandler extends CommandHandler {
...
@@ -78,7 +79,7 @@ public class UpdateCommandHandler extends CommandHandler {
})
})
.
build
();
.
build
();
this
.
commandUpdate
=
gson
.
fromJson
(
command
.
getData
(),
CommandUpdate
.
class
);
this
.
commandUpdate
=
gson
.
fromJson
(
command
.
getData
(),
CommandUpdate
.
class
);
this
.
updateApk
=
new
File
(
Utils
.
getApp
().
getCacheDir
(),
UPDATE_APK
);
this
.
updateApk
=
new
File
(
PathUtils
.
getExternalStoragePath
(),
UPDATE_APK
);
}
}
private
void
init
(
Command
command
,
Gson
gson
,
CommandProgressCallback
callback
)
{
private
void
init
(
Command
command
,
Gson
gson
,
CommandProgressCallback
callback
)
{
...
...
daemon/src/main/java/com/bgycc/smartcanteen/daemon/ServiceApplication.java
View file @
5cf16966
...
@@ -3,13 +3,27 @@ package com.bgycc.smartcanteen.daemon;
...
@@ -3,13 +3,27 @@ package com.bgycc.smartcanteen.daemon;
import
android.app.Application
;
import
android.app.Application
;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.CrashUtils
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.Utils
;
import
com.blankj.utilcode.util.Utils
;
import
java.io.File
;
public
class
ServiceApplication
extends
Application
{
public
class
ServiceApplication
extends
Application
{
private
static
final
String
LOG_PREFIX
=
"daemon"
;
private
static
final
String
LOG_DIR
=
"log"
;
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
Utils
.
init
(
getApplicationContext
());
Utils
.
init
(
getApplicationContext
());
CrashUtils
.
init
();
CrashUtils
.
init
();
String
logDir
=
PathUtils
.
getExternalStoragePath
()
+
File
.
separator
+
LOG_DIR
;
CrashUtils
.
init
(
logDir
);
LogUtils
.
getConfig
()
.
setDir
(
logDir
)
.
setLog2FileSwitch
(
true
)
.
setBorderSwitch
(
false
)
.
setFilePrefix
(
LOG_PREFIX
);
}
}
}
}
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