Commit 1c4d70d5 by pye52

规范化命名

parent 1aead235
...@@ -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);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment