aboutsummaryrefslogtreecommitdiffstats
path: root/src/standardPush/java/de/pixart/messenger/services/PushMessageReceiver.java
blob: d45ded4546c999683687138ad3c90838d26f6089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
        intent.putExtra("account", data.get("account"));
        startService(intent);
    }
}