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.java25
1 files changed, 25 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..85e92552
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/services/EventReceiver.java
@@ -0,0 +1,25 @@
+package de.thedevstack.conversationsplus.services;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import de.thedevstack.conversationsplus.persistance.DatabaseBackend;
+
+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);
+ }
+ }
+
+}