Execute "onMessageReceived" on background

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

メンテナーはふだん 1 日以内に返信

@chong-shao がすでに取り組んでいます。

2022年5月17日 から。

評価

この issue はまだ評価されていません。

説明

api: messaging
[READ] Step 1: Are you in the right place?
  • I like to send a "data message" throw this nuget (no notification), so the "onMessageReceived" method was call on android in even in background.
  • Actually, I use HTTP legacy URI : https://fcm.googleapis.com/fcm/send and I'm able to send "data message" and "notification message"
  • I try to use "HTTP v1" instead, but I can't send "data message", I always receive a "notification message"
[REQUIRED] Step 2: Describe your environment
  • Operating System version: ubuntu 22.04
  • Firebase SDK version: 2.3.0
  • Firebase Product: messaging
  • .NET version: net6.0
  • OS: linux
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:

Send a message with :

var message = new Message()
{
    Token = myToken,
    Notification = new Notification
    {
        Body = notification.Message.GetLanguage(device.DeviceLanguage),
        Title = notification.Title.GetLanguage(device.DeviceLanguage),
    },
    Android = new AndroidConfig
    {
        TimeToLive = TimeSpan.FromHours(1),
        Priority = Priority.High,
        Notification = new AndroidNotification
        {
            ChannelId = GetAndroidChannelId("alertChannel", soundName)
        }
    },
    Data = new Dictionary<string, string>() { }
};
var fcmResponse = await FirebaseMessaging.DefaultInstance.SendAsync(message);

I receive a "notification message" :)

var message = new Message()
{
    Token = myToken,
    Android = new AndroidConfig
    {
        TimeToLive = TimeSpan.FromHours(1),
        Priority = Priority.High,
        Notification = new AndroidNotification
        {
            ChannelId = GetAndroidChannelId("alertChannel", soundName)
        }
    },
    Data = new Dictionary<string, string>() { }
};
var fcmResponse = await FirebaseMessaging.DefaultInstance.SendAsync(message);

I receive a "notification message" not a "data message" :(

I aslo try to force the Notification property as null. But I had the same result

var message = new Message()
{
    Token = myToken,
    Notification = null,
...

There is something I can do ?

主要言語
C#
スター
407
フォーク
147
平均マージ
2日 10時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

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

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

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

似ている issue

C# の issue をもっと見る

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

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