[firebase_messaging] Android: messages sent to the FID from register() fail with UNREGISTERED; iOS works

未关闭
#19,017 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
dart, flutter

调研方向

Start by tracing FirebaseMessaging.instance.register() and the Android onRegistered path that returns the FID; compare it with the iOS registration flow, which the report says works. Reproduce with the listed manifest setting and send an HTTP v1 message to the returned FID. Done means Android FID registration supports delivery without the reported 404 UNREGISTERED response.

由索引模型根据 Issue 内容生成。

描述

Needs Attention platform: android plugin: messaging type: bug
Is there an existing issue for this?
  • I have searched the existing issues.
Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

With FID-based registration (FirebaseMessaging.instance.register() + onRegistered), every FCM HTTP v1 send to the FID returned on Android fails with 404 UNREGISTERED (messaging/installation-id-not-registered).

Reproducing the issue
  1. Add to AndroidManifest.xml:
  2. In Dart:
    FirebaseMessaging.instance.onRegistered.listen((fid) => sendToBackend(fid));
    await FirebaseMessaging.instance.register();
  3. Send an FCM HTTP v1 message to that FID (firebase-admin send({ fid, notification }) or a direct REST call).
  4. → 404 UNREGISTERED. The same steps on iOS (FirebaseMessagingInstallationIdEnabled = true in Info.plist) deliver the message.
Firebase Core version

5.2.0

Flutter Version

3.50.1

Relevant Log Output
# Device (adb logcat, FirebaseMessaging VERBOSE)
D/FirebaseMessaging: Invoking onNewToken for app: [DEFAULT]
D/FirebaseMessaging: onServiceConnected: ComponentInfo{<package>/io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingService}
I/flutter: FID: <FID>

# Server (firebase-admin)
code: messaging/installation-id-not-registered
{
  "error": {
    "code": 404,
    "message": "NotRegistered",
    "status": "NOT_FOUND",
    "details": [{ "@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError", "errorCode": "UNREGISTERED" }]
  }
}
Flutter dependencies
Expand Flutter dependencies snippet
firebase_core 5.2.0
firebase_core_platform_interface 8.2.0
firebase_messaging 17.1.0
firebase_messaging_platform_interface 4.12.0
Additional context and comments

Device: OnePlus 6T, Android 15, Google Play services 26.45.31.

主要语言
Dart
星标
9.3k
派生
4.1k
平均合并
4 天 17 小时
30 天内合并 PR
49

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/flutterfire 的其他 Issue

查看 firebase/flutterfire 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。