Skip to content

Push messages do not work on Android #906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasons-codes opened this issue Dec 21, 2020 · 6 comments
Closed

Push messages do not work on Android #906

jasons-codes opened this issue Dec 21, 2020 · 6 comments
Labels
api: messaging needs-attention Need Googler's attention

Comments

@jasons-codes
Copy link

jasons-codes commented Dec 21, 2020

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.12f1
  • Firebase Unity SDK version: 7.0.1
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Cloud Messaging
  • Other Firebase Components in use: Analytics, Crashlytics
  • Additional SDKs you are using: Facebook, GoogleMobileAds, GoogleSignin, UnityMobileNotification, UnityIAP, etc
  • Platform you are using the Unity editor on: macOS
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

Push messages do not work on Android.

Steps to reproduce:

https://firebase.google.com/docs/cloud-messaging/unity/client?hl=en
I added FCM to my project as described in that link.
However, while iOS works fantastically, I haven't received any push messages on Android.

The test environment is as follows.

  • iOS: Testing with Xcode development certificate
  • Android: Testing to build apk with local keystore (both the signature for AAB managed by Google and the signature of Keystore managed by Google are registered in Google Play)

The FCM version in use is 7.0.1.


Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

Not tested

What's the issue repro rate? (eg 100%, 1/5 etc)

100% (It doesn't always work on Android)

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

FCM push notifications do not work on Android.
FirebaseMessaging.TokenReceived checked the log with logcat when Firebase was initialized, but FirebaseMessaging.MessageReceived has no log in logcat even though it sends multiple push messages.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

If the problem persists, I plan to write a test sample and I will share it at that time.

@jasons-codes
Copy link
Author

jasons-codes commented Dec 21, 2020

My project's Google Play Console is using a Google-managed signature, but I also added a Keystore fingerprint that I manage.

So, I registered both the signature of my keystore and the signature provided by Google with Firebase. (SHA-1 and SHA-256 are registered 2 each and a total of 4 fingerprints are registered)

And I created AAB to check if it is an issue due to app signing, but as a result of Google Play internal testing, AAB also did not receive a push message.

@DellaBitta
Copy link
Contributor

Hi @jason-codes,

I think this might be a duplicate of #883 6.16.x FCM notifications not received clicking PushNotification on Android. Could you check it to confirm? Thanks!

@DellaBitta DellaBitta added needs-info Need information for the developer and removed new New issue. labels Dec 21, 2020
@DellaBitta
Copy link
Contributor

Also note #877 to which #883 refers.

@jasons-codes
Copy link
Author

jasons-codes commented Dec 22, 2020

Hi @DellaBitta,

In my case, either the foreground or the background, the push message doesn't appear on Android. Even FirebaseMessaging.MessageReceived is unresponsive.

I ran a local notification with Unity Mobile Notification to see if my app couldn't print notifications on Android.
And local notifications worked fine.

https://github.com/firebase/quickstart-unity/tree/master/messaging/testapp
Next, I downloaded the sample here and installed FCM 7.0.2 as the package manager.
I set many options (App ID, IL2CPP, keystore of my app, etc.) the same as my project and tested Android, FCM works fine with this sample!

What is the difference?
As much as possible, I tried to modify my project again to be the same as that implemented in the sample, but FCM does not work in the Android build of my project.

I plan to install and test the Facebook SDK, Google Sign-in, Google Mobile Ads, gRPC, and many other plugins that are being used in my project in the sample project next day to see if the third-party library is the problem.
But it's too hard to find a problem this way.
Are there any other hints?

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Dec 22, 2020
@jasons-codes
Copy link
Author

I figured out what was causing the problem.

The previous Firebase 6.x.x version creates the Assets/Plugins/Android/Firebase folder, and the current Firebase 7.0.x version creates FirebaseApp.androidlib instead of that folder.

When upgrading Firebase, the old folder was not deleted, and if I delete it manually, Android push message works fine.

Thanks you.

@DellaBitta
Copy link
Contributor

Hi @jasons-codes,

Great, I'm glad to hear the news and thanks for circling back to us with the information. I'm going to close this issue for now. Thanks again!

@firebase firebase locked and limited conversation to collaborators Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: messaging needs-attention Need Googler's attention
Projects
None yet
Development

No branches or pull requests

3 participants