Firebase onMessageReceived not called when app in background

前端 未结 26 2654
粉色の甜心
粉色の甜心 2020-11-22 02:32

I\'m working with Firebase and testing sending notifications to my app from my server while the app is in the background. The notification is sent successfully, it even appe

26条回答
  •  抹茶落季
    2020-11-22 03:22

    Just call this in your MainActivity's onCreate Method :

    if (getIntent().getExtras() != null) {
               // Call your NotificationActivity here..
                Intent intent = new Intent(MainActivity.this, NotificationActivity.class);
                startActivity(intent);
            }
    

提交回复
热议问题