Skip to content
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

No notifications to Android whitelabel app #4997

Closed
rochafabrizio opened this issue Mar 24, 2023 · 13 comments
Closed

No notifications to Android whitelabel app #4997

rochafabrizio opened this issue Mar 24, 2023 · 13 comments

Comments

@rochafabrizio
Copy link

Description:

I have downloaded Rocket Chat single-server branch (version 4.36.0), then I followed Android App White Labelling (https://developer.rocket.chat/mobile-app/mobile-app-white-labelling/android-app-white-labelling).

Environment Information:

  • Rocket.Chat Server Version: 4.8.1
  • Rocket.Chat App Version: 4.36.0
  • Device Name:
  • OS Version: Android 12

Steps to reproduce:

I have created a new project on Firebase, added a new Android application and downloaded google-services.json file.

I have downloaded and configured Rocket Chat ReactNative single-server branch, version 4.36.0, for white labeling as document (https://developer.rocket.chat/mobile-app/mobile-app-white-labelling/android-app-white-labelling).

At Rocket Chat server web UI, on Administration > Settings > Push, I have turned off "Enable Gateway", I kept "Production" on and added "GCM API Key" and "GCM Project Number".

Note that for "GCM API Key" I have copied the value from google-service.json file under api_key current_key value and for "GCM Project Number" I have copied from Firebase "Sender ID".

Also, I have changed "server" key from app.json file to match our domain address.

Expected behavior:

Notification should be received on mobiles.

Actual behavior:

No notifications are presented.

Additional context:

@rochafabrizio
Copy link
Author

Additionally, I get notifications when I start campaigns from Firebase Console. This means that I have an app with google-services.json correctly intalled on my device, right!?

@GleidsonDaniel
Copy link
Contributor

Yes, most likely the error is in the configuration in the settings panel and not really the app itself.

@rochafabrizio
Copy link
Author

rochafabrizio commented Mar 27, 2023

Hi Gleidson, thank you for you suggestion. You mean Settings panel from within Rocket Chat App, right!? Maybe you are right, that's why I want to validate where the values to GCM fields come from.

What else would impact Android notifications?

Thanks!

@rochafabrizio
Copy link
Author

From logs I see the following entries:
{"level":20,"time":"2023-03-27T20:47:35.428Z","pid":1411258,"hostname":"","name":"Push","msg":"ANDROID ERROR: result of sender"}
{"level":20,"time":"2023-03-27T20:27:56.161Z","pid":1410954,"hostname":"","name":"Push","msg":"For devices running Android 8.0 or later you are required to provide an android_channel_id. See Meteor-Community-Packages/raix-push#341 for more info"}

Is it information only or related to missing notifications?

@GleidsonDaniel
Copy link
Contributor

@diegolmello can help you better

@diegolmello
Copy link
Member

The android_channel_id is just a warning.
We force the channel id on the app, so it's not a problem.

{"level":20,"time":"2023-03-27T20:47:35.428Z","pid":1411258,"hostname":"","name":"Push","msg":"ANDROID ERROR: result of sender"}

How did you test this?

When the app logs in, it sends the device's push token to the backend.
This token is used to send the push notification, so make sure the token exist on the backend.

Also note that every time you change something on Push section on Admin, you'll have to restart the server.

If it doesn't work, make sure to debug the push logic on backend to understand what's happening.

@rochafabrizio
Copy link
Author

Hello Diego, thank you for your feedback!

So the channel_id message is just a warning, ok no more concerns about that.

Well, about test scenario, it was pretty trivial, I've downloaded single-server branch from git, then I've made changes to customize it to my environment and finally I've compiled it using yarn.

Actually, I've made one more change to package.json file, I've added a new line to "scripts" section to use experimentalPlayRelease variant:

"android-whitelabel-release": "npx react-native run-android --main-activity chat.rocket.reactnative.MainActivity --variant=experimentalPlayRelease --appId", So I've run yarn android-whitelabel-release instead of what is in the documentation.

When configuring Push at Rocket Chat WebUI, I've used the API KEY from google-services,json since I kept Cloud Messaging API (Legacy) disabled at Firebase Console.

With all that set, I've published a new release to Google Play Console to Internal Testers, so during tests I've got that message from RC Logs.

In order to generate the bundle from Android Studio I've used Build > Generate Signed Bundle / APK and in the prompt screen I've used keystore file, alias and password as previously created according to documentation.

If I'm missing any information please let me know.

@diegolmello
Copy link
Member

When configuring Push at Rocket Chat WebUI, I've used the API KEY from google-services,json since I kept Cloud Messaging API (Legacy) disabled at Firebase Console.

This could be the issue.
Since you're whitelabelling instead of using our push gateway, you're using this lib https://github.com/ToothlessGear/node-gcm
Take a look at the new docs (based on recent Firebase changes) to understand if it points to the correct direction.
Please let us know if it fixes so we can update our docs.
Thanks!

@rochafabrizio
Copy link
Author

Ow, I forgot to say, I've created an out of the app notification campaign on Firebase Console and my Rocket Chat Whitelabeled App was able to receive it successfully. Does that mean that the tunnel from FB to app is ok?

@diegolmello
Copy link
Member

Yes, because it's simpler than that.
The communication Rocket.Chat App <-> Firebase is working.
You need to fix the configuration Rocket.Chat Backend <-> Firebase to be able to send push notifications.

@rochafabrizio
Copy link
Author

rochafabrizio commented Mar 31, 2023

Diego, your first comment was the light to figure out what was the problem. I was getting the GCM API Key from wrong place. RC documentation is fine, for some how we changed it and, as soon as we corrected it, notifications started popping out. Thanks for your help.

@biostunt
Copy link

I was getting the GCM API Key from wrong place

Hi, rochafabrizio, can you show right place of getting the GCM API Key?

@tamalbachar
Copy link

Diego, your first comment was the light to figure out what was the problem. I was getting the GCM API Key from wrong place. RC documentation is fine, for some how we changed it and, as soon as we corrected it, notifications started popping out. Thanks for your help.

@rochafabrizio @diegolmello i followed the same steps. i enabled the Cloud Messaging API (Legacy) and copied the server key and sender id and pasted it in GCM API Key and GCM Project Number (in settings) respectively. The notifications still didnt work. any idea what can be the possible problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants