diff --git a/calculatorpp-service/AndroidManifest.xml b/calculatorpp-service/AndroidManifest.xml
new file mode 100644
index 00000000..d1739b4a
--- /dev/null
+++ b/calculatorpp-service/AndroidManifest.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/calculatorpp-service/pom.xml b/calculatorpp-service/pom.xml
new file mode 100644
index 00000000..b518441b
--- /dev/null
+++ b/calculatorpp-service/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+
+ org.solovyev.android
+ calculatorpp-parent
+ 1.2.34
+
+
+ 4.0.0
+
+ org.solovyev.android
+ calculatorpp-service
+ 0.1
+ apklib
+
+
+
+
+ com.intellij
+ annotations
+ 7.0.3
+
+
+
+ com.google.android
+ android
+ provided
+
+
+
+
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ 3.1.1
+
+
+
+
+
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ 1.0-alpha-2
+
+
+ initialize
+
+ read-project-properties
+
+
+
+ ${basedir}/src/misc/env/env.properties
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calculatorpp-service/src/main/java/org/solovyev/android/calculator/CalculationService.java b/calculatorpp-service/src/main/java/org/solovyev/android/calculator/CalculationService.java
new file mode 100644
index 00000000..6a40cd6d
--- /dev/null
+++ b/calculatorpp-service/src/main/java/org/solovyev/android/calculator/CalculationService.java
@@ -0,0 +1,74 @@
+package org.solovyev.android.calculator;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.*;
+import android.os.Process;
+import android.widget.Toast;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: serso
+ * Date: 3/5/12
+ * Time: 10:23 PM
+ */
+public class CalculationService extends Service {
+
+ @NotNull
+ private ServiceHandler handler;
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Toast.makeText(this, ".CalculationService.onStartCommand", Toast.LENGTH_SHORT).show();
+
+ // For each start request, send a message to start a job and deliver the
+ // start ID so we know which request we're stopping when we finish the job
+ final Message msg = handler.obtainMessage();
+ msg.arg1 = startId;
+ handler.sendMessage(msg);
+
+ // If we get killed, after returning from here, restart
+ return START_STICKY;
+ }
+
+
+ @Override
+ public void onCreate() {
+ Toast.makeText(this, ".CalculationService.onCreate", Toast.LENGTH_SHORT).show();
+ // first time initialization
+
+ // Start up the thread running the service. Note that we create a
+ // separate thread because the service normally runs in the process's
+ // main thread, which we don't want to block. We also make it
+ // background priority so CPU-intensive work will not disrupt our UI.
+ final HandlerThread thread = new HandlerThread("ServiceStartArguments", Process.THREAD_PRIORITY_BACKGROUND);
+ thread.start();
+
+ handler = new ServiceHandler(thread.getLooper());
+
+ }
+
+ @Override
+ public void onDestroy() {
+ // last time call
+ Toast.makeText(this, ".CalculationService.onDestroy", Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ private final class ServiceHandler extends Handler {
+
+ private ServiceHandler(@NotNull Looper looper) {
+ super(looper);
+ }
+
+ @Override
+ public void handleMessage(@NotNull Message msg) {
+ Toast.makeText(CalculationService.this, "Doing job!", Toast.LENGTH_SHORT).show();
+ stopSelf(msg.arg1);
+ }
+ }
+}
diff --git a/calculatorpp/AndroidManifest.xml b/calculatorpp/AndroidManifest.xml
index 0dd28db4..60c5c126 100644
--- a/calculatorpp/AndroidManifest.xml
+++ b/calculatorpp/AndroidManifest.xml
@@ -8,7 +8,7 @@
-
+
@@ -18,6 +18,8 @@
+
+
diff --git a/calculatorpp/pom.xml b/calculatorpp/pom.xml
index 09a54975..5a1a7ba7 100644
--- a/calculatorpp/pom.xml
+++ b/calculatorpp/pom.xml
@@ -56,6 +56,13 @@
apklib
+
+ org.solovyev.android
+ calculatorpp-service
+ 0.1
+ apklib
+
+
org.solovyev
jscl
diff --git a/calculatorpp/project.properties b/calculatorpp/project.properties
index 9898e890..c4bcf4cf 100644
--- a/calculatorpp/project.properties
+++ b/calculatorpp/project.properties
@@ -9,4 +9,5 @@
# Project target.
target=android-15
-android.library.reference.1=gen-external-apklibs/org.solovyev.android_billing_0.1
+android.library.reference.1=../../common
+android.library.reference.2=../calculatorpp-service
diff --git a/pom.xml b/pom.xml
index 1a238a95..092ab6ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,6 +12,7 @@
../common
+ calculatorpp-service
calculatorpp
calculatorpp-test
@@ -26,7 +27,7 @@
com.google.android
android
- 2.3.3
+ 4.0.1.2
provided
@@ -68,11 +69,11 @@
15
-
+
+
true