urbanairship / android-library

Urban Airship Android SDK
Other
109 stars 123 forks source link

Push notifications not received & push address going blank #206

Closed victorlsn closed 2 years ago

victorlsn commented 2 years ago

❗For how-to inquiries involving Airship functionality or use cases, please contact (support)[https://support.airship.com/].

Preliminary Info

What Airship dependencies are you using?

urbanairship-fcm 16.4.0

What are the versions of any relevant development tools you are using?

Android Studio Dolphin | 2021.3.1 Canary 8

Report

What unexpected behavior are you seeing?

I'm not receiving push notifications on Android. When I first open the app and the push token is registered then associated to a certain user, I'm able to see the push address as expected on Contact Management, but when I trigger I try to send a push notification (either from a server event or directly from airship website) the push address goes blank on Contact Management and I never receive any notification, though I'm still able to retrieve the push token via FirebaseMessaging.getInstance().getToken().addOnCompleteListener or UAirship.shared().getPushManager().getPushToken() Screen Shot 2022-05-23 at 20 46 23 Screen Shot 2022-05-23 at 20 47 25 Screen Shot 2022-05-23 at 20 48 13 Screen Shot 2022-05-23 at 20 48 57

What is the expected behavior?

Receiving push notifications normally - and push address not going blank on Contact Management.

What are the steps to reproduce the unexpected behavior?

I'm not sure if this is what triggered the issue, but recently I've been testing the migration to EU server (but I'm 100% sure I'm using the correct configurations when initialising the version to test this issue. I've also tested different SDK versions: 16.0.0, 16.3.3, 16.4.0 & 16.5.0.

Do you have logging for the issue?

No

rlepinski commented 2 years ago

What is most likely happening here is the google project that the SDK is using to generate the token is not the google project that is configured in the dashboard. When the push is sent we will get a mismatch sender ID and clear the token on the channel to prevent additional errors with FCM.

When you updated from 16.x did you use to set a senderId override on the config? If so that is probably the mismatch. You need to configure the project now and tell us the FCM name. https://docs.airship.com/platform/android/advanced/firebase-fcm-project/

victorlsn commented 2 years ago

Hey @rlepinski! Thanks for your answer! But no, I don't think I used to set a senderId override... As a matter of fact, after testing a bit here I found out that if I use the EU server, the issue doesn't happen at all. I'm both receiving the push notifications & the push address does not go blank (and I'm using the exact same configuration on the dashboard for both US and EU servers, at least for the Mobile/Android part). IOS is unnafected, everything is working normally.

Unfortunately, we're only migrating to the EU server in the next version of our app, so for now our customers are not receiving notifications.

rlepinski commented 2 years ago

@victorlsn If you run the app and point to US vs EU, do you have the same push token on each site?

victorlsn commented 2 years ago

@rlepinski indeed, the push token is the same, despite having different channel ids. eu com

rlepinski commented 2 years ago

I am going to have to escalate this to our backend team. I don't think you have anything wrong with your setup as far as I can tell. The only thing to check on your end is if the server key configured for android is the same between the two projects.

victorlsn commented 2 years ago

Yes, I've double-checked (triple-checked, even) and I'm using the exact same Google Firebase server key & Google Firebase package.

rlepinski commented 2 years ago

@victorlsn I actually see a lot of mismatch sender IDs in your US project.

This is probably annoying and you might of already done it, but could you:

victorlsn commented 2 years ago

@rlepinski I was trying to do some testing here and so I changed the server key, maybe that's why you saw mismatches? I've already set it back to the correct value. But then again, I'm gonna do what you're asking!

victorlsn commented 2 years ago

PS: I'm trying to do this to retrieve my channelId on the version currently on the Play Store and I'm only getting empty value (ua:). I'm pretty sure it was working before. When installing from Android Studio I'm able to get it just fine.

rlepinski commented 2 years ago

The only thing that would prevent a channel from being created is if the app credentials are misconfigured, if you implemented some sort of feature/data collection enablement, or if you are delay channel creation (have to set some flag to delay it, probably not that).

We can focus on your dev version right now, get that working then figure out the play store version if you want.

victorlsn commented 2 years ago

Somehow, I'm getting notifications from US server now. Both sending from dashboard & via app events. I'm gonna try & upload a new version to internal track on play store to test this.

victorlsn commented 2 years ago

Hey @rlepinski, I'm not sure if: You guys did something there; It was some intermittency; Or if I did some change that turned out good here; But since running from Android Studio was working well, I've uploaded a new version to Play Store (Internal) and it seems to be working just fine.

Thanks a lot for your help!

rlepinski commented 2 years ago

Well, either way 🎉

Let me know if you run into any other issues.