aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-03-06 00:00:16 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-03-06 00:00:16 +0100
commite4f61da07924e9440cde5b92c4364b1310c64ce5 (patch)
tree84bb8190768b677ef34094ede5817571ca466ec8
parent1124ded2005fa5b0b9504bac383743e31212bab7 (diff)
start service on boot
-rw-r--r--AndroidManifest.xml35
-rw-r--r--src/eu/siacs/conversations/services/EventReceiver.java17
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java2
3 files changed, 41 insertions, 13 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0e59383c..881ed7e3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -9,28 +9,39 @@
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
- <uses-permission android:name="android.permission.READ_PROFILE"/>
+ <uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
-
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light" >
- <service android:name="eu.siacs.conversations.services.XmppConnectionService"/>
+ <service android:name="eu.siacs.conversations.services.XmppConnectionService" />
+
+ <receiver android:name="eu.siacs.conversations.services.EventReceiver" >
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
+ </receiver>
+
<activity
android:name="eu.siacs.conversations.ui.ConversationActivity"
+ android:configChanges="orientation|screenSize"
android:label="Conversations"
- android:windowSoftInputMode="stateHidden"
- android:configChanges="orientation|screenSize">
+ android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
+
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- <intent-filter>
+ <intent-filter>
<action android:name="android.intent.action.SENDTO" />
+
<category android:name="android.intent.category.DEFAULT" />
+
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
@@ -45,25 +56,25 @@
android:label="Manage Accounts"
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
</activity>
- <activity
+ <activity
android:name="eu.siacs.conversations.ui.MucDetailsActivity"
android:label="Conference Details"
- android:windowSoftInputMode="stateHidden">
+ android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="eu.siacs.conversations.ui.ContactDetailsActivity"
android:label="Contact Details"
- android:windowSoftInputMode="stateHidden">
+ android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="eu.siacs.conversations.ui.NewConversationActivity"
android:label="@string/title_activity_new_conversation"
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity"
- android:windowSoftInputMode="stateHidden">
+ android:windowSoftInputMode="stateHidden" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.gultsch.chat.ui.ConversationActivity" />
</activity>
</application>
-</manifest>
+</manifest> \ 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 00000000..41e31114
--- /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 a2951c65..c1b64f22 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);
}