Reputation: 9407
I have been using firebase unity(beta) plugin for push notification. I can get push notification data when my app is opened from notification screen with this method.
public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {
Debug.Log("Received a new message");
}
But I can't get push notification data when my app is in foreground. How can I get this data? Anybody help?
Upvotes: 1
Views: 1145
Reputation: 1
Old thread but if anyone else comes across this, I was receiving messages all of the time on Android but on iOS, OnMessageReceived would not fire until I added content_available: true to the firebase notification payload.
Now, all is good and I can trigger actions in my foreground app through arbitrary data.
Upvotes: 0
Reputation: 9407
This solution solved my problem.
public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) {
NotificationServices.GetRemoteNotification (NotificationServices.remoteNotificationCount-1);
}
Upvotes: 1