Execute "onMessageReceived" on background

Đang mở
#326 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@chong-shao đang làm issue này rồi.

Từ ngày 17/5/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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 ?

Ngôn ngữ chính
C#
Star
407
Fork
147
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-admin-dotnet

Tất cả issue của firebase/firebase-admin-dotnet

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.