firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
370 stars 131 forks source link

IOS data message not work #154

Closed HorjeaCosmin closed 4 years ago

HorjeaCosmin commented 4 years ago

Hi,

I'm trying to send data message using FirebaseAdmin.Messaging component. While on Android it works well, on IOS we cannot handle whatever we do. Our client application is react-native and the back-end environment is asp.net core 3.0.

Server side implementation:

... var notificationMessage = new MulticastMessage { Tokens = registrationTokens, Data = payloadData, Android = new AndroidConfig { TimeToLive = 10, Priority = Priority.High, }, Apns = new ApnsConfig { Aps = new Aps { ContentAvailable = true, } } };

var response = await FirebaseMessaging.DefaultInstance.SendMulticastAsync(notificationMessage);

...

React-native: ... this.messageListener = firebase.messaging().onMessage((message) => { console.log(message) } ...

One additional information, notification message work on both IOS and Android.

I'm looking forward for any help community can provide.

Regards, Cosmin

charlotteliang commented 4 years ago

Can you show us a sample code on how you handle message receiving on iOS?

HorjeaCosmin commented 4 years ago

Like I already wrote above:

this.messageListener = firebase.messaging().onMessage((message) => { console.log(message) }

Actually, on IOS simulator everything works fine for both Android / IOS, only on IOS real device it doesn't work.

Regards, C

charlotteliang commented 4 years ago

hmmm I'm not aware of this API in our iOS SDK. Are you sure this is Firebase Messaging iOS SDK you are using?

I'm talking about the "onMessage((message)" part that I don't find it in iOS API. https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase/Messaging/Public/FIRMessaging.h

HorjeaCosmin commented 4 years ago

Hi @chliangGoogle,

please check this reference that we're using: https://rnfirebase.io/docs/v5.x.x/messaging/receiving-messages

Regards, C

charlotteliang commented 4 years ago

The API you referred is react native adoptions on top of firebase so I'm afraid you need to check with their team to see if why their api couldn't handle it correctly.

charlotteliang commented 4 years ago

@Feiyang1 Can you double check to see if this API belongs to our js SDK or it's react native's APIs.

Feiyang1 commented 4 years ago

https://rnfirebase.io builds on top of the native iOS SDK. Its APIs are similar to the JS SDK, but it eventually delegates to the native iOS SDK.

hiranya911 commented 4 years ago

It doesn't look like there's a bug in the Admin SDK here. If you continue to have issues with receiving notifications on iOS, please raise an issue with Firebase Support.