aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-25 23:03:26 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-25 23:03:59 +0100
commitce2cf51df08b8b0ad4250c3396975108aa3f5085 (patch)
treea3dc10ed007e2c6734cb707583e806a6a8b86103 /src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
parentd4a584c88a80ebf3f48bbe5ecb9860de3c59dbbb (diff)
explicitly start service (instead of just bind) service from contact chooser
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java')
-rw-r--r--src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
index 006b6e918..7bda592e5 100644
--- a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
+++ b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java
@@ -18,6 +18,7 @@ import java.util.List;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.ui.ConversationsActivity;
+import de.pixart.messenger.utils.Compatibility;
@TargetApi(Build.VERSION_CODES.M)
public class ContactChooserTargetService extends ChooserTargetService implements ServiceConnection {
@@ -37,10 +38,14 @@ public class ContactChooserTargetService extends ChooserTargetService implements
@Override
public List<ChooserTarget> onGetChooserTargets(ComponentName targetActivityName, IntentFilter matchedFilter) {
- Intent intent = new Intent(this, XmppConnectionService.class);
+ final ArrayList<ChooserTarget> chooserTargets = new ArrayList<>();
+ if (!EventReceiver.hasEnabledAccounts(this)) {
+ return chooserTargets;
+ }
+ final Intent intent = new Intent(this, XmppConnectionService.class);
intent.setAction("contact_chooser");
+ Compatibility.startService(this, intent);
bindService(intent, this, Context.BIND_AUTO_CREATE);
- ArrayList<ChooserTarget> chooserTargets = new ArrayList<>();
try {
waitForService();
final ArrayList<Conversation> conversations = new ArrayList<>();