aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/EventReceiver.java2
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/EventReceiver.java b/src/main/java/de/pixart/messenger/services/EventReceiver.java
index e4ec8cdb7..6200a40ce 100644
--- a/src/main/java/de/pixart/messenger/services/EventReceiver.java
+++ b/src/main/java/de/pixart/messenger/services/EventReceiver.java
@@ -32,7 +32,7 @@ public class EventReceiver extends BroadcastReceiver {
}
}
- public boolean hasEnabledAccounts(Context context) {
+ public static boolean hasEnabledAccounts(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SETTING_ENABLED_ACCOUNTS, true);
}
diff --git a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
index ffbb93425..d45ded454 100644
--- a/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
+++ b/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
@@ -1,13 +1,20 @@
package de.pixart.messenger.services;
import android.content.Intent;
+import android.util.Log;
import java.util.Map;
+import de.pixart.messenger.Config;
+
public class PushMessageReceiver extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage message) {
+ if (!EventReceiver.hasEnabledAccounts(this)) {
+ Log.d(Config.LOGTAG, "PushMessageReceiver ignored message because no accounts are enabled");
+ return;
+ }
Map<String, String> data = message.getData();
Intent intent = new Intent(this, XmppConnectionService.class);
intent.setAction(XmppConnectionService.ACTION_FCM_MESSAGE_RECEIVED);