【问题标题】:open app automatically when fcm notification is received while app is kill or on background当应用程序被杀死或在后台时收到 fcm 通知时自动打开应用程序
【发布时间】:2020-01-28 11:36:09
【问题描述】:

如何解决这个问题任何人都可以根据这个问题向我发送任何解决方案

收到fcm通知但应用未打开如何处理

public void onMessageReceived(RemoteMessage remoteMessage) {

        Intent intent = new Intent(INTENT_FILTER);
        sendBroadcast(intent);

        if (remoteMessage.getData().size() > 0) {
            utils.print(TAG, "From: " + remoteMessage.getFrom());
            utils.print(TAG, "Notification Message Body: " + remoteMessage.getData());
            //Calling method to generate notification
            if (SharedHelper.getKey(this,"loggedIn").equalsIgnoreCase(getString(R.string.True))) {

                sendNotification(remoteMessage.getData().get("message"));
            }
        }

【问题讨论】:

  • 请任何人发送此问题的一些解决方案如何在收到通知时自动打开应用程序

标签: android push-notification firebase-notifications


【解决方案1】:

你应该像这样在 Manifest 中声明 firebase 服务类:

 <service android:name="your_service>
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>

【讨论】:

  • 我也像收到 fcm 通知一样使用,但我想在收到通知时自动打开应用程序'
猜你喜欢
  • 1970-01-01
  • 2019-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-21
  • 2020-02-10
  • 1970-01-01
  • 2020-03-22
相关资源
最近更新 更多