aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java b/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java
new file mode 100644
index 00000000..4367dd1b
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java
@@ -0,0 +1,24 @@
+package de.thedevstack.conversationsplus.services;
+
+import de.thedevstack.conversationsplus.persistance.DatabaseBackend;
+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() != null) {
+ mIntentForService.setAction(intent.getAction());
+ } else {
+ mIntentForService.setAction("other");
+ }
+ if (intent.getAction().equals("ui")
+ || DatabaseBackend.getInstance(context).hasEnabledAccounts()) {
+ context.startService(mIntentForService);
+ }
+ }
+
+}