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

Not Storing token id in appCollection

Open
#112 5 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

Hello Raix,

I have added config.push.json into my code base with only GCM credentials as follows:
{
"gcm": {
"apiKey": "My api key",
"projectNumber": int number
},
"production": true
}

Also created startup.js

Meteor.startup(function(){
if (Meteor.isCordova){
Push.debug = true
console.log('startup event cordova');
// window.alert = navigator.notification.alert;

```
//ONLY This works
Push.addListener('token', function(token) {
console.log('token received: ' + JSON.stringify(token));
});

Push.addListener('error', function(err) {
console.log(err);
});

Push.addListener('message', function(notification) {
// Called on every message
console.log(JSON.stringify(notification))
alert(notification.message);
```

})

Push.addListener('alert', function(notification) {
// Called on every message
Dialog.alert(notification.message);
console.log(notification.message);
});
}
})

Only I received token in console but not in my Push.appCollection.find().fetch().

I ran my command
meteor run android-device --mobile-server http://serverName.meteor.com/

Thanks,

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 config.push.json and startup.js, then reproduce the Android-device run using the documented meteor command. Compare the token received by the Push.addListener('token') handler with Push.appCollection.find().fetch(). Done means the received token is stored and visible in appCollection, or the issue is narrowed to the storage path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.