0

I'm trying to make something similar to messenger/whatsapp call by using FCM. When app is in foreground, i recieve data, and new activity (call info) is launched. The problem appears when the app is in background or killed. I recieve the data from FCM, but nothing else happen.

Here is the part of FCM code that I tried

    public void onMessageReceived(RemoteMessage remoteMessage) {
        Log.d(TAG, "From: " + remoteMessage.getFrom());

        // Check if message contains a data payload.
        if (remoteMessage.getData().size() > 0) {
            Log.d(TAG, "Message data payload: " + remoteMessage.getData());
            
            Intent intent = new Intent(getApplicationContext(), Dzwoni.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intent);
        }

How can I start activity when I recieve FCM data?

mk2342
  • 1

0 Answers0