From e4f61da07924e9440cde5b92c4364b1310c64ce5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 6 Mar 2014 00:00:16 +0100 Subject: [PATCH] start service on boot --- AndroidManifest.xml | 35 ++++++++++++------- .../conversations/services/EventReceiver.java | 17 +++++++++ .../siacs/conversations/ui/XmppActivity.java | 2 +- 3 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 src/eu/siacs/conversations/services/EventReceiver.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0e59383c0..881ed7e36 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -9,28 +9,39 @@ android:targetSdkVersion="19" /> - + - - + + + - + + + + + + + + + android:windowSoftInputMode="stateHidden" > + - + + + @@ -45,25 +56,25 @@ android:label="Manage Accounts" android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" > - + android:windowSoftInputMode="stateHidden" > + android:windowSoftInputMode="stateHidden" > + android:windowSoftInputMode="stateHidden" > - + \ No newline at end of file diff --git a/src/eu/siacs/conversations/services/EventReceiver.java b/src/eu/siacs/conversations/services/EventReceiver.java new file mode 100644 index 000000000..41e31114f --- /dev/null +++ b/src/eu/siacs/conversations/services/EventReceiver.java @@ -0,0 +1,17 @@ +package eu.siacs.conversations.services; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class EventReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + Intent mIntentForService = new Intent(context, XmppConnectionService.class); + if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) { + + } + context.startService(mIntentForService); + } + +} diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index a2951c65a..c1b64f228 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -37,9 +37,9 @@ public abstract class XmppActivity extends Activity { @Override protected void onStart() { - startService(new Intent(this, XmppConnectionService.class)); super.onStart(); if (!xmppConnectionServiceBound) { + startService(new Intent(this, XmppConnectionService.class)); Intent intent = new Intent(this, XmppConnectionService.class); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }