Jeff Posey avatar image
Jeff Posey asked

sent_push_notification event failing


I have Push Notifications set up using Firebase in my Android build, and it is working when I trigger notifications from Firebase.

However, I am having trouble getting PlayFab to send them to Firebase. For player accounts other than mine, which have not registered for them, I get this error:

"Push notifications not enabled for account."

That seems just fine. However, I get the following error when it tries to send it to my account that is registered.

"Android Push Notification Failed: Client push notification registration not found."

In Firebase, when sending a message, it tells me there are 1 eligible devices to receive it. That makes sense. So I am pretty sure I registered.

Why am I getting the registration not found error?

Title ID: 55477

Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Posey avatar image Jeff Posey commented ·

It may be worth noting that the very first sent_push_notification in my event log says it was a Success, but I didn't get it. (November 9, 2019 12:45 AM). All other attempts have failed, either from manually clicking Send Push Notification from the Player screen, or the automated ones from my Entered Segment Actions.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Jeff Posey commented ·

May I ask have you called AndroidDevicePushNotificationRegistration API on the application client side, before you send the push notification template?

0 Likes 0 ·
Jeff Posey avatar image Jeff Posey Seth Du ♦ commented ·

Yeah, I am using the following code. You will notice I tell it to give me a ConfirmationMessage, but I haven't seen it. So I didn't believe it was working. However, it really seems like this worked for my account, because PlayFab gives me the Send Push Notification option now on my Player account, and when sending manually from Firebase, it says there are 1 devices eligible and I get those notifications.

var request = new AndroidDevicePushNotificationRegistrationRequest { DeviceToken = pushToken, SendPushNotificationConfirmation = true, ConfirmationMessage = "Push notifications registered successfully" }; PlayFabClientAPI.AndroidDevicePushNotificationRegistration(request, OnPfAndroidReg, OnPfFail);
0 Likes 0 ·
Show more comments

1 Answer

Jeff Posey avatar image
Jeff Posey answered

Ok. I figured it out. It was in my Firebase setup code, and I think it was because I was trying to add the callbacks for OnTokenReceived inside the ContinueWith function here:

Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>

I moved the adding of the callbacks outside of this, and everything is working now.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.