Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Android device only receive 1 notification when offline.

オープン
#812 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
android, java

調査の方向性

AndroidConfig.builder().setCollapseKey の使用方法と、issue に記載されている Firebase Admin Java SDK 9.1.1 の設定から始めます。Android デバイスを機内モードにし、FCM HTTP v1 エンドポイントを介して異なる collapse key を指定した通知を 3 件送信して再現し、その結果を APNs の設定と比較します。Android の配信動作が想定どおりかどうかを判断するか、SDK または FCM の文書化された問題を特定できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

My app sends non-collapsible push notification.
When push notification are sent while device is online, everything works fine. Notifications are sent one by one. The problem is that if the device is offline (closed or airplane mode) only the last notification sent is received when the device come back online.

A work around that seems to be popular online is to generate unique collapseKey to force firebase to push notification in separate "collapse group".
I know the limit is only 4 collapse key, but it is enough notifications for the app I'm building.

I've achieved the desired result on IOS by settings my apns-collapse-id to a random UUID for each notifications but now that I'me trying with android it doesn't seems to work.

I uses
Firebase-admin version 9.1.1

<dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>firebase-admin</artifactId>
      <version>9.1.1</version>
</dependency>

This library uses FCM HTTP v1 endpoint

The collapseKey fields works.
When setting it with this function : AndroidConfig.builder().setCollapseKey("non_unique_collapse_key").build()

The notifications are overwritten.

If I set it like this : AndroidConfig.builder().setCollapseKey(UUID.randomUUID().toString()).build()

All notification are sent separately.

The problem is that if I put my android to airplane mode, send myself 3 notifications (with 3 different collapse_key)
When I put my device back online, I only receive the last notification sent.

The same cannot be said for IOS.

I set my notification like so :

ApnsConfig.builder().putHeader("apns-collapse-id", collapseKey)
        .setAps(Aps.builder().setAlert(
            ApsAlert.builder().setTitle(title).setBody(notificationContent).build()).build())
        .build();

and when I put my iphone back online, I receive 3 notifications.

主要言語
Java
スター
620
フォーク
305
平均マージ
4日 9時間
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-admin-java のほかの issue

firebase/firebase-admin-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。