startActivity from FirebaseMessagingService.onMessageReceived is not work on several devices


Push-message is coming, but startActivity don't work on some devices. Lsat what i see in log file is:

intent: Intent { flg=0x10000000 (has extras) }

The problem is seen on several devices with API 27 and 23, but all other devices work's good.

I managed to reproduce this problem on the API 29 emulator, but only if the application is unloaded from memory. On all other API 24-28 emulators, this code works without problems.

It's my FirebaseMessagingService class:

public class MyFirebaseMessagingServiceTest extends FirebaseMessagingService {
    // Get push-message.
    public void onMessageReceived(RemoteMessage remoteMessage) {

        // Get data.
        Map<String, String> data = remoteMessage.getData();
        logger.trace("data: {}", data);
        // If data is not empty.
        if (remoteMessage.getData().size() > 0) {
            logger.trace("remoteMessage.getData().size() > 0");
            // Run activity.
            Intent intent = new Intent(getApplicationContext(), MyActivity.class);
            intent.putExtra("data", "data");
            logger.trace("intent: {}", intent);

            try {
            } catch (Exception exception) {
                logger.error("Exception", exception);

It's my AndroidManifest.xml file:

<service android:name=".Core.MyFirebaseMessagingService">
        <action android:name="" />

Any help please?

asked on Stack Overflow Nov 19, 2019 by spice0xff

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0