Meteor-Community-Packages / Meteor-Community-Packages/raix-push

[v3.0.3-rc.7][v3.0.2] Android FCM not working

Open
#259 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
505
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Since we migrated from Google GCM to FCM on Firebase and upgraded the package to v3.0.3-rc.7, I can't get Android notifications to work.
Here's my settings.json

```
{
"public": {
"environment": "staging",
"pushClient": {
"android": {
"senderID": "XXXXXXXXXX",
"alert": true,
"badge": true,
"sound": true,
"vibrate": true,
"clearNotifications": true
},
"ios": {
"alert": true,
"badge": true,
"sound": true
}
}
},
"pushServer": {
"apn": {
"passphrase": "XXXXXXX",
"gateway": "gateway.push.apple.com",
"production": true
},
"gcm": {
"apiKey": "XXXXXXXXX",
"projectNumber": "XXXXXXXXX"
},
"production": true,
"sound": true,
"badge": true,
"alert": true,
"vibrate": true
},
"pushServerKeys": {
"cert": "apnCert.pem",
"key": "apnKey.pem"
}
}

```

This is my server/push.js

```
// Configure Push Notifications - raix:push
let pushConfigs = Meteor.settings.pushServer;
pushConfigs.apn.keyData = Assets.getText(Meteor.settings.pushServerKeys.key);
pushConfigs.apn.certData = Assets.getText(Meteor.settings.pushServerKeys.cert);

Push.Configure(pushConfigs);

Push.addListener('error', (error) => {
throw new Meteor.Error(error);
});

if (Meteor.settings.public.environment !== 'production') {
Push.debug = true; // Add verbosity
}
```

And this is my client/push.js:

```
Push.Configure(Meteor.settings.public.pushClient);
```

iOS Notifications are working, but that's the log I get for Android notifications:

```
Push: Send message "Someone is interested!" via query { userId: 'ahPcp7cmLnAa42xW3' }
send to token { gcm: 'JHG84DDCJ61fcLscyJAsbua368asjbdsvdhajsv276bjahvd_AhfJASVHGsghav-BjJxMhF2dc2LD6zzwYfJxwGcahAHGSVshvA6l_HvE9gwItWuYi-t4h4caJv0t5YJ1-iSHGF_5g' }
sendGCM [ 'NGS71bF1ZlRCJ61fcLscyZD2N1sYXzsX7_WwLCzc9eNnH0T9WEbo9nap_NnAqLqeDSF32D-BjJxMhSfshav387ydh6zzwYfJxwGcpFWmxqdxA6l_ds465jfSG3wsHGSVj-t4h4caJv0t5YJ1-iWIb_6a' ] { _id: 'j3gfQtA69ggahnfC',
createdAt: Thu Oct 06 2016 00:01:00 GMT+0000 (UTC),
createdBy: '',
from: 'Post',
title: 'Someone is interested!',
text: 'Carl is interested in attending your event.',
badge: 1,
query: { userId: 'hsja7g54anAa42g4H' },
sent: false,
sending: 0 }
Create GCM Sender using "kuBSsJH789OX6EfV03Ka0D9wbHhw7vbaj37JHSb36"
A:Send message to: NGS71bF1ZlRCJ61fcLscyZD2N1sYXzsX7_WwLCzc9eNnH0T9WEbo9nap_NnAqLqeDSF32D-BjJxMhSfshav387ydh6zzwYfJxwGcpFWmxqdxA6l_ds465jfSG3wsHGSVj-t4h4caJv0t5YJ1-iWIb_6a
Push: Sent message "Someone is interested!" to 0 ios apps 1 android apps
ANDROID ERROR: result of sender: undefined
```

PS: all the keys and sensitive info was modified before posting.
PPS: tried to downgrade back to 3.0.2 with old GCM key, but still can't get Android notifications to work, even though it's currently working with our production code.
Hers's the error message:

```
Unauthorized
ANDROID: Result of sender is null
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with settings.json and the Push.Configure calls in server/push.js and client/push.js, then review the Android send logs showing an Unauthorized response and a null sender result. Compare the FCM-related configuration used by v3.0.3-rc.7 and v3.0.2. Done means Android notifications are delivered while iOS behavior remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, javascript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.