[URGENT] FCM Cordova Integration (iOS)

Hi Everyone,

I was trying to add cordova-plugin-fcm in my project but getting error as

  • Error: cordova-plugin-fcm: You have installed platform ios but file ‘GoogleService-Info.plist’ was not found in your Cordova project root folder

Also, apart from this, I tried to integrate other available plugins but none of them works as expected. Can anyone can help me in this. Any help will be greatly appreciated.

Hi @mixmatric,
are you trying to get Push notifications to IOS?

Yes @paulishca . Have you done it in the past?

Hi there,
you will need RAIX:Push (it is fully documented and includes Web notifications) or the more updated technology but a little less documented activitree:push ( No web push). I am the owner of activitree:push and in case you want to go for this, I can personally help you. My package uses APN for IOS not FCM. I am not sure about RAIX.

That’s great, Can you tell me the basics steps to integrate this?
I need to know how are you generating token using this?
I need it for iOS only.

Install the package. In the Example folder you have all the necessary bits including PNG photos of various things. Implementation for activitree and RAIX is similar, my package being a re-write of RAIX.

  1. Install the package.
  2. Generate a p8 certificate with Push entitlement.
  3. Install the required cordova-plugin-push (2.1.2 if you are less than Meteor 1.8.1 and need Android in the future or 2.2.3 any other case.)
  4. Add the server code
  5. Add the client code.
  6. Build for IOS.
  7. Go into your cordova IOS folder with a Terminal and run ‘pod install’
  8. Drop your custom notification sound files if any.
  9. Archive or deploy your App.
  10. Your tokens will be generated only in production (as far asa I remember) so you need to deploy a production build to a phone to actually see the tokens generated (after you confirm accepting notifications on your mobile screen).
  11. For debugging you may use this: https://github.com/activitree/NODE-APN-Notifications-Tester .
  12. If you liked it and discovered a new thing … contribute or drop me a line and I will add it to the repo.

Do, I need to add code for Raix:push in order to generate the tokens?

either or , do RAIX and follow RAIX documentation in Github or do activitree:push and follow the points above. They are … different, completely independent from one another.

Sorry, but I don’t understood, what should I add in client and server code?
Ideally, I need to generate the token and store it into the database and when sending the notification I need to use the stored token.

I checked the doc, there is nothing related with token as such or I might have missed something.

All those things you should not worry about.This is why a Push cordova plugin is wrapped for Meteor. The Meteor package does all the hard work.

I need to generate token, So that I could store it and send notification to the user I want.

@mixmatric you literally only need to do what I listed there for you. Server and Client code you may find in the Example in the repo, in the exact places where you could add the snipets.

If you want, find me on a skype chat at paulailincai (Dubai, UAE)

 CordovaPush.on('startup', notif => {
        Push.addListener('token', function(token) {  
          if(token.gcm!=undefined || token.gcm !=null)
          Session.setPersistent("userToken",token.gcm);
          else if(token.apn!=undefined || token.apn !=null)
          {
          Session.setPersistent("userToken",token.apn);  
          }
        });
    })

is it fine for token generation?

I am afraid I don’t recognize this code. GCM is not in use any more and as I see “Session” I take it you use Blaze? I believe you are still aiming to generate a token when this is already taken care of by the Push package for Meteor (one of RAIX or activitree). If you are trying to use RAIX or you use Blaze, I cannot help you but RAIX documentation is really detailed.

Well, the scenerio is something difficult, the web is using APN to send notification and on iOS I just need to generate the token, I got your point to not really worried about the token because in this the case would be like using the methods given by you in the example sample project.
The web and iOS app are two different projects. I hope this will make the things clear

Not really. APN for Node is used for a Meteor (Node) server to send a notification to an Apple Notification server.The Apple server sends the notification to your device. What the Meteor packages do in parallel to what the phone does:

  1. IOS device uses cordova-push-plugin to generate the token.
  2. Meteor client takes the token and sends to Meteor server.
  3. Meteor Server writes the token in Mongo for your user.

Send notification e.g send “note” to a userId.

  1. Search in Mongo push collection, identify the token for a userID.
  2. Node sends the “note” to APN for a certain token.
  3. Apple receives the “note” notification and directs it to your mobile.
  4. Mobile receives notification.

With a meteor Push package you just need to add the server and clients Javascript components and write your methods logic. So, APN is not related to web but to the relation Meteor Node Server - Apple.

Yes, Apple server send notification based on the token generated by cordova-push-plugin. But what if I am able to generate the token from cordova-push-plugin and then store it in my database, and while sending notification if I used that stored token then will it work?

Its just like I can’t generate token in my current scenario rest things are working fine.

Also, with Raix Push I was able to generate the token but it returns null when someone downloaded the app from Apple store. Is there any same issue you know regarding raix:push Package?