diff --git a/replugin-sample/plugin/plugin-demo1/app/src/main/AndroidManifest.xml b/replugin-sample/plugin/plugin-demo1/app/src/main/AndroidManifest.xml
index 5ea3039..3cd89c7 100644
--- a/replugin-sample/plugin/plugin-demo1/app/src/main/AndroidManifest.xml
+++ b/replugin-sample/plugin/plugin-demo1/app/src/main/AndroidManifest.xml
@@ -81,6 +81,8 @@
+
diff --git a/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/MainApp.java b/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/MainApp.java
index 7cadb75..4a2aab0 100644
--- a/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/MainApp.java
+++ b/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/MainApp.java
@@ -17,6 +17,9 @@
package com.qihoo360.replugin.sample.demo1;
import android.app.Application;
+import android.content.Intent;
+
+import com.qihoo360.replugin.sample.demo1.service.PluginDemoAppService;
/**
* @author RePlugin Team
@@ -26,5 +29,14 @@ public class MainApp extends Application {
@Override
public void onCreate() {
super.onCreate();
+
+ // 在插件启动时就去开启一个服务,以模拟个别插件的复杂行为
+ testStartService();
+ }
+
+ private void testStartService() {
+ Intent i = new Intent(this, PluginDemoAppService.class);
+ i.setAction("MyNameIsApp");
+ startService(i);
}
}
diff --git a/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/service/PluginDemoAppService.java b/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/service/PluginDemoAppService.java
new file mode 100644
index 0000000..b0e807e
--- /dev/null
+++ b/replugin-sample/plugin/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/service/PluginDemoAppService.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2017 Qihoo 360 Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed To in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.qihoo360.replugin.sample.demo1.service;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+import com.qihoo360.replugin.sample.demo1.support.LogX;
+
+/**
+ * @author RePlugin Team
+ */
+public class PluginDemoAppService extends Service {
+
+ public static final String TAG = "demo.service.app";
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ LogX.logDebug(TAG, "onCreate()");
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ String action = intent.getAction();
+ Log.d(TAG, "onStartCommand(): act=" + action);
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ LogX.logDebug(TAG, "onDestroy()");
+ }
+}