+package de.rmdir.ms2debounce;
+
+import android.app.Service;
+import android.content.Intent;
+import android.content.Context;
+import android.os.IBinder;
+import android.os.AsyncTask;
+import android.util.Log;
+
+public class DebounceBootService extends Service
+{
+ private static final String TAG = "DebounceBootService";
+
+ public IBinder onBind(Intent intent)
+ {
+ return null;
+ }
+
+ @Override
+ public void onCreate()
+ {
+ Log.i(TAG, "Starting AsyncTask");
+ new AsyncTask<DebounceBootService, Void, Void>() {
+ @Override
+ protected Void doInBackground(DebounceBootService... svc) {
+ Context context = getApplicationContext();
+ DebounceModuleHelper module = new DebounceModuleHelper(context);
+
+ Log.i(TAG, "Loading Module");
+
+ try {
+ module.loadModule();
+ } catch (Exception e) {
+ Log.e(TAG, "Got Exception: " + e.getMessage() + " (" + e.getCause() + ")");
+ }
+
+ svc[0].stopSelf();
+
+ return null;
+ }
+ }.execute(this);
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId)
+ {
+ Log.i(TAG, "Creating STICKY service");
+ return START_STICKY;
+ }
+
+ @Override
+ public void onDestroy()
+ {
+ Log.i(TAG, "Destroying service");
+ }
+}