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
1c4d70d5
authored
Mar 16, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
规范化命名
parent
1aead235
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
daemon/src/main/java/com/bgycc/smartcanteen/daemon/DaemonService.java
+4
-4
No files found.
daemon/src/main/java/com/bgycc/smartcanteen/daemon/DaemonService.java
View file @
1c4d70d5
...
@@ -23,7 +23,7 @@ public class DaemonService extends Service {
...
@@ -23,7 +23,7 @@ public class DaemonService extends Service {
// 主应用package name
// 主应用package name
private
static
final
String
MAIN_PACKAGE_NAME
=
"com.bgycc.smartcanteen"
;
private
static
final
String
MAIN_PACKAGE_NAME
=
"com.bgycc.smartcanteen"
;
// 主应用类名称
// 主应用类名称
private
static
final
String
MAIN_
SERVICE
_NAME
=
"com.bgycc.smartcanteen.MainActivity"
;
private
static
final
String
MAIN_
ACTIVITY
_NAME
=
"com.bgycc.smartcanteen.MainActivity"
;
@Override
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
...
@@ -34,8 +34,8 @@ public class DaemonService extends Service {
...
@@ -34,8 +34,8 @@ public class DaemonService extends Service {
}
}
// 当找不到安装apk时,直接启动主应用
// 当找不到安装apk时,直接启动主应用
if
(!
FileUtils
.
isFileExists
(
path
))
{
if
(!
FileUtils
.
isFileExists
(
path
))
{
LogUtils
.
w
(
TAG
,
"安装失败, 找不到apk"
);
LogUtils
.
w
(
TAG
,
"安装失败, 找不到apk
,重新启动主应用
"
);
ComponentName
componentName
=
new
ComponentName
(
MAIN_PACKAGE_NAME
,
MAIN_
SERVICE
_NAME
);
ComponentName
componentName
=
new
ComponentName
(
MAIN_PACKAGE_NAME
,
MAIN_
ACTIVITY
_NAME
);
Intent
startMainActivity
=
new
Intent
();
Intent
startMainActivity
=
new
Intent
();
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setComponent
(
componentName
);
intent
.
setComponent
(
componentName
);
...
@@ -46,7 +46,7 @@ public class DaemonService extends Service {
...
@@ -46,7 +46,7 @@ public class DaemonService extends Service {
String
component
=
intent
.
getStringExtra
(
ARG_COMPONENT
);
String
component
=
intent
.
getStringExtra
(
ARG_COMPONENT
);
if
(
TextUtils
.
isEmpty
(
component
))
{
if
(
TextUtils
.
isEmpty
(
component
))
{
component
=
MAIN_PACKAGE_NAME
+
File
.
separator
+
MAIN_
SERVICE
_NAME
;
component
=
MAIN_PACKAGE_NAME
+
File
.
separator
+
MAIN_
ACTIVITY
_NAME
;
LogUtils
.
d
(
TAG
,
"安装完毕启动包名为空,使用默认包名: "
+
component
);
LogUtils
.
d
(
TAG
,
"安装完毕启动包名为空,使用默认包名: "
+
component
);
}
}
...
...
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