当应用程序有后台处理程序时,Flutter 中未收到 FCM 通知

FCM notifications not received in Flutter when there is a background handler for the app

我的应用程序中有 FCM 配置,它工作正常,直到我在应用程序后台 运行 状态下调用我的后台处理程序, 我明白了

Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7d7493b) but could not find and invoke the GeneratedPluginRegistrant.

但是当我尝试使用手动注册时 flutterEngine?.getPlugins()?.add(FirebaseMessagingPlugin())

我知道 FCM 已经注册了这个引擎, 然后从未收到通知

这就是我调用后台处理程序的方式:

    if (flutterEngine == null) {
        handler?.let { callbackRawHandle ->
            flutterEngine = FlutterEngine(contextm).also { engine ->
                val callbackInformation =
                    FlutterCallbackInformation.lookupCallbackInformation(callbackRawHandle)
                engine.dartExecutor.executeDartCallback(
                    DartExecutor.DartCallback(
                        contextm!!.getAssets(),
                        FlutterMain.findAppBundlePath(),
                        callbackInformation
                    )
                )
            }
        }
        
    }

答案在这里 FCM/GitHub 我问了FCM Developers同样的问题,新的更新应该可以解决这个问题。