FCM Plugin discrepancy

There is a discrepancy between

and

The Ionic docs ask to use FCM like below:

import { FCM } from ‘@ionic-native/fcm’;
constructor(private fcm: FCM) {}

but the github read me requires the declaration of a var FCMPlugin

declare var FCMPlugin;
FCMPlugin.method here

Which one is to be used? Does anyone know of a better way to use firebase messaging?

The first one. The upstream plugin knows nothing of ionic-native syntax.

Thanks for your response @rapropos
When I do this I get these errors, it seems like I should be using the other no?

cordova.js:989
Error: exec proxy not found for :: FCMPlugin :: ready

FCMPlugin.js:40
FCMPlugin Ready ERROR

FCMPlugin.js:4
FCMPlugin.js: is created

I’ve never used this plugin, but are you sure you did all of the other installation tasks in the ionic-native doc page, such as actually installing the corresponding cordova plugin and adding the provider to your app module?

Ionic Native uses the Cordova plugin internally. That is why you are getting error messages from the plugin.

Can you post a screenshot of the error in the browser console?

What exactly did you do to install both plugins?

I installed it as outlined by the docs @rapropos

ionic cordova plugin add cordova-plugin-fcm npm install --save @ionic-native/fcm

and then added it to my app’s NgModule as a provider.

I got this error in the console @Sujan12

error

FWIW, there seem to be over 200 open issues against that plugin, including this one that looks remarkably similar to your situation.

Hes using FCMPlugin in that post. I agree though this plugin seems problematic @rapropos .
That is why I asked if there was no better way :stuck_out_tongue:

Think of it this way. The person who opened that issue went to a restaurant. You phoned a delivery service that brings food from many different restaurants. At the end of the day, you’re still eating the same meal, although it has been presented in two different fashions.

Haha well I like the analogy but unfortunately I think neither of us are enjoying the meal. For some reason I think cordova isnt finding the “exec proxy” for FCMPlugin and that is the root of the issue. Any ideas? I tried uninstalling and reinstalling the plugin to no avail.

UPDATE: I reverted to using the FCMPlugin notation according to the github and

This seemed to crash less but still not perfect. The only other advise is to minimize whats happening in this.platform.ready().