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

GCM - "Push.appCollection" is empty

Open
#55 28 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

Hi!
I have tried to connect my app using the basic guide but still ends up with "Push.appCollection" is empty...

I have created an app in Developer Console.
I have enabled Google Cloud Messaging for Android.
In my config.push.json I have:

{
  "gcm": {
    "apiKey": "AIzaSyCD4fDb2OZPzvRQxjWxxQ_XXXXXXXXX",
    "projectNumber": 150189635563
  },
  "production": false,
  "sound": true,
   "alert": true,
  "vibrate": true
}

In my client/client.js I have:

Push.addListener('token', function(token) {
  console.log('Token: ' + JSON.stringify(token));
  alert('Token: ' + JSON.stringify(token));
});
console.log('Push.id(): ' + Push.id());

In my server/pushServer.js I have:

Push.allow({
  send: function(userId, notification) {
    return true; // Allow all users to send
  }
});
Push.debug = true;

And in client/details.js I call the Push.send like so:

function sendPush(pushObject){
    console.log('Pushing: ' + JSON.stringify(pushObject));
    Push.send({
        from: pushObject.from,
        title: pushObject.title,
        text: pushObject.text,
    query: {}
    });
}

And the console outputs:

=> App running at: http://localhost:3000/
I20150408-13:11:24.084(2)? Push.Configure { gcm: { apiKey: 'AIzaSyCD4fDb2OZPzvRQxjWxxQ_XXXXXXXXX' },
I20150408-13:11:24.086(2)?   production: false,
I20150408-13:11:24.086(2)?   sound: true,
I20150408-13:11:24.086(2)?   alert: true,
I20150408-13:11:24.086(2)?   vibrate: true }
I20150408-13:11:24.086(2)? GCM configured
I20150408-13:11:44.735(2) (android:http://meteor.local/client/client.js:5) Push.id(): tANjKGjGT67XDL28M
I20150408-13:12:53.843(2)? Push: Send message "Aktivitet tillagd" via query {}
I20150408-13:12:53.844(2)? Push: Sent message "Aktivitet tillagd" to 0 ios apps 0 android apps
I20150408-13:12:53.847(2)? Push, GUIDE: The "Push.appCollection" is empty - No clients have registred on the server yet...

Where XXXXXXXXX is just for posting this issue.

Could you guide me in the right direction?
I have also tried uploading the app to heroku, but with the same result.
/Pelle

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

Review config.push.json and the registration flow referenced by client/client.js, then compare its output with server/pushServer.js and the Push.send call in client/details.js. Reproduce the empty Push.appCollection result and use the existing debug output to identify where registration stops; done means a client appears in the collection and Push.send reports a recipient.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
backend, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.