Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
513 stars 197 forks source link

No APN token received #20

Open ndevr opened 9 years ago

ndevr commented 9 years ago

Hello,

first of all - great project.

I was following these steps: https://github.com/raix/push/wiki/iOS-Micro-Walkthrough but i didn't received an token. I check everything 3x times and created new profiles, certificates etc. but nothing helps. Is there something what i can do to send a token manually from my phone? Is there a special case for the app for deploying to my phone?

Regards ndevr

raix commented 9 years ago

make sure to set the --mobile-server http://x.x.x.x

ndevr commented 9 years ago

Where is you config.push.json located? When I'am locking into the xcode sources at ".meteor/local/cordova-build/platforms/ios/www/application/push.config.web.cordova.js" then the content looks like the default one:

Push.Configure({ "gcm": { "projectNumber": "" }, "production": false, "sound": true, "badge": true, "alert": true, "vibrate": true });

raix commented 9 years ago

gcm is missing the apiKey?

raix commented 9 years ago

skip the sound/badge/alert/vibrate flags for now...

ndevr commented 9 years ago

i did not setup somthing there. Thats what the project was building.

raix commented 9 years ago

Moment...

ndevr commented 9 years ago

my config.push.json at the root folder of the project:

{ "apn": { "passphrase": "123456", "key": "testKey.pem", "cert": "testCert.pem", "gateway": "gateway.sandbox.push.apple.com" }, "gcm": { "apiKey": "", "projectNumber": "" }, "production": false, "badge": true, "sound": true, "alert": true, "vibrate": true }

raix commented 9 years ago

Create

  1. config.push.json in your app folder
  2. Make sure you have a projectNumber and apiKey for android
  3. Make sure to run the app using --mobile-server
ndevr commented 9 years ago

Can i disable android for now?

raix commented 9 years ago

Notes:

Add Push.debug = true; on client+server and read the console

raix commented 9 years ago

If the server doesnt receive the push token when the app startup the you need to debug the client, if the token is sent to the server then fire up meteor shell and look at the data Push.appCollection.find().fetch(); If the data is in there and apiKey is set in your config it should work. Begin debugging your network ports could be stopped by firewalls or you might havent set the meteor flag --mobile-server

raix commented 9 years ago

Also try using Push.send in the meteor shell - unless you havent removed the insecure package.

ndevr commented 9 years ago

Okay i did everything but nothing happens. Should there be a debug log entry on the xdebug console and could you tell me what is in you ".meteor/local/cordova-build/platforms/ios/www/application/push.config.web.cordova.js" file ? I think the client will not setup correct.

raix commented 9 years ago

The https://github.com/raix/push/issues/20#issuecomment-68905933 looks ok - please debug as explained in https://github.com/raix/push/issues/20#issuecomment-68907510 - and read the server and browser console log

You could test if app gets token: On the client:

Push.addListener('token', function(token) {
  alert(JSON.stringify(token));
});
adamgins commented 9 years ago

ps. remember to do --mobile-server http://x.x.x.x:port if you're running this with another port other than 80 ;-)

maabed commented 9 years ago

In my case i can only see the token when i run meteor.startup function

Meteor.startup(function () {
 Push.addListener('token', function(token) {
     alert(JSON.stringify(token));
   });
});

Using development certification, hope this helps

raix commented 9 years ago

The meteor.startup should not matter, it will emit when ready

ndevr commented 9 years ago

Nothing helped yet. Strange :/ can you tell me where i can find the config of the apn on the ios project which is created from config.push.json?

ndevr commented 9 years ago

Well ok i think i found the problem. I didn't received the dialog for the push notifcations. With that script i receive a token: https://gist.github.com/ndevr/b3187f244dfb0f77dd34

Any idea why i not received the dialog?

raix commented 9 years ago

Are we talking apn or gcm?

ndevr commented 9 years ago

apn

raix commented 9 years ago

Check if the app have notification options under settings on the iphone/iOS if not certs etc is not configured correctly.

ndevr commented 9 years ago

Now I'am receiving messages when i register the handler and doing a manually push-update with the token. Looks like the handler is not registered correctly, but i need abit more time for debugging.

dennisharrison commented 9 years ago

I'm just catching up to this issue. I don't think your client is connected to the server. Please make sure of that first of all.

I'll be able to pay more attention to this tomorrow. Don't worry, you're close :)

dennisharrison commented 9 years ago

I'm reading this again.

@ndevr Are you saying you have a client token in the collection on your server?

Push.appCollection.find().fetch();

What is the return?

ndevr commented 9 years ago

Yes, i pushed the token into the collection with Meteor.call('raix:push-update') and can send notifications from server/client. But I had to re-register the handlers.

raix commented 9 years ago

This should all happen pr. default, the device should register etc. - is this still an issue on the latest version?

ClarenceL commented 9 years ago

I just had 1 out of 4 devices not self-register, very odd, but it must still be happening.