Meteor-Community-Packages / raix-push

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

Notifications not working for IOS #305

Open nabelou10 opened 7 years ago

nabelou10 commented 7 years ago

I followed the steps carefully but after deploying my app with Heroku; the app slows down and does not get any notifications. Maybe someone get tell me what I did wrong. My push-server code

import { Meteor } from 'meteor/meteor';

Meteor.startup(function () {

  if( !Meteor.settings.fcm.serverKey || !Meteor.settings.public.fcm.senderId ){
    return;
  }

  Push.Configure({
    apn: {
    certData: Assets.getText('fbdev.pem'),
    keyData: Assets.getText('fbkeydev.pem'),
    passphrase: '********',
    production: true,
},
    gcm: {
      apiKey: Meteor.settings.fcm.serverKey,
      senderID: Meteor.settings.public.fcm.senderId
    },
    production: true,
    badge: true,
    sound: true,
    alert: true,
    vibrate: true,
    sendInterval: 3000,
    sendBatchSize: 1
  });
});

Meteor.methods({
  'sendNotification': function(user) {
    check(user, String);

    if( !Meteor.settings.fcm.serverKey || !Meteor.settings.public.fcm.senderId ){
          if( Meteor.isDevelopment ){
        console.log('Push Notifications are not enabled. Please enter your API keys for Google FCM.')
      }
      return;
    }

    Push.send({
      from: 'FleaBrocante',
      title: 'FleaBrocante',
      text: 'Vous avez un nouveau message',
      badge: 1,
      query: {
        userId: user
      }
    });
  }
});

And my push-client code

import { Meteor } from 'meteor/meteor';

Meteor.startup(function () {

  if( !Meteor.settings.public.fcm.senderId ){
    return;
  }

  Push.Configure({
    android: {
      senderID: Meteor.settings.public.fcm.senderId,
      iconColor: '#0C431B',
      icon: 'pushicon',
      badge: true,
      sound: true,
      alert: true,
      vibrate: true,
    },
    ios: {
  alert: true,
  badge: true,
  sound: true
}
  });
});

I have the .pem files inside /private; I get notifications on Android but nothing and IOS

mikeislearning commented 7 years ago

Here's how mine looks

    Push.Configure({
      apn: {
        certData: Assets.getText('cert-prod.pem'),
        keyData: Assets.getText('key-prod.pem'),
        passphrase: '*********',
        production: true,
        gateway: 'gateway.push.apple.com',
      },
      gcm: {
        apiKey: 'apikey',
        projectNumber: 123456789,
      },
      production: true,
      sound: true,
      alert: true,
      vibrate: true,
    });

The only thing you're missing is gateway