# Native: tried calling FCM.getToken, but the FCM plugin is not installed. ionic 5

**URL:** <https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883>\
**Category:** Ionic Framework\
**Created:** [June 27, 2020, 7:25am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883 "2020-06-27T07:25:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [June 27, 2020, 7:25am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/1 "2020-06-27T07:25:23Z")

</div>

FCM: has been created  
FCMPlugin.js:26 FCM: Ready!  
vendor-es2015.js:103665 Ionic Native: deviceready event fired after 1 ms  
vendor-es2015.js:103970 Native: tried calling FCM.getToken, but the FCM plugin is not installed.  
pluginWarn @ vendor-es2015.js:103970  
vendor-es2015.js:103976 Install the FCM plugin: ‘ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated’  
???  
its not given me the token  
any help?

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [June 28, 2020, 9:31am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/2 "2020-06-28T09:31:20Z")

</div>

ok so i fix it by using this code  
import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic”;  
with out (privet fcm:FCM)  
fcm.gettoken().then(re=\>{

})

---

<div class="post-metadata">

**Author:** ![Omer\_Ced](https://avatars.discourse-cdn.com/v4/letter/o/2acd7d/32.png) [@Omer\_Ced](https://forum.ionicframework.com/u/Omer_Ced)\
**Post date:** [July 2, 2020, 1:12pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/3 "2020-07-02T13:12:43Z")

</div>

Hello, I have a similar problem, I cannot get the token.

![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/b/bbebff0d7ed1b55e6b0b627169b6f00dd89881d7.png)

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [July 2, 2020, 3:29pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/4 "2020-07-02T15:29:50Z")

</div>

use this

```auto
cordova plugin add cordova-plugin-androidx-adapter

```

```auto
cordova plugin add cordova-plugin-androidx

```

and then  
import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic”;

to get token  
FCM.gettoken().then(re=\>{  
// ==========================  
})

---

<div class="post-metadata">

**Author:** ![piyushs](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@piyushs](https://forum.ionicframework.com/u/piyushs)\
**Post date:** [July 10, 2020, 8:31pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/5 "2020-07-10T20:31:03Z")

</div>

![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/d/3dd1885e15af69483e25ac3c74fad8d894ec3284.png)

its gettng me blank white screen.

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [July 10, 2020, 8:47pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/6 "2020-07-10T20:47:28Z")

</div>

use it without (privet fcm:FCM)  
directly

---

<div class="post-metadata">

**Author:** ![piyushs](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@piyushs](https://forum.ionicframework.com/u/piyushs)\
**Post date:** [July 10, 2020, 9:02pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/7 "2020-07-10T21:02:46Z")

</div>

yes, I use with out it.  
its give me token,  
But still can’t get notification from Firebase console on that token.

---

<div class="post-metadata">

**Author:** ![piyushs](https://avatars.discourse-cdn.com/v4/letter/p/e47774/32.png) [@piyushs](https://forum.ionicframework.com/u/piyushs)\
**Post date:** [July 10, 2020, 10:05pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/8 "2020-07-10T22:05:38Z")

</div>

import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic/ngx”;

private fcm: FCM,

it’s working fine.

---

<div class="post-metadata">

**Author:** ![pankajpandey](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pankajpandey](https://forum.ionicframework.com/u/pankajpandey)\
**Post date:** [August 2, 2020, 1:09pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/9 "2020-08-02T13:09:23Z")

</div>

It is not working in prod mode release.

we always use **ionic cordova build android** for android build.

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [August 2, 2020, 6:32pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/10 "2020-08-02T18:32:12Z")

</div>

can u take photo to see what happening there

---

<div class="post-metadata">

**Author:** ![pankajpandey](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pankajpandey](https://forum.ionicframework.com/u/pankajpandey)\
**Post date:** [August 5, 2020, 2:17pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/11 "2020-08-05T14:17:09Z")

</div>

After create .apk file with command and installed on mobile. It just display blank white screen only and not move to login or home page. If you want I can send you blank white screen from mobile.

---

<div class="post-metadata">

**Author:** ![nkhlshnd](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nkhlshnd](https://forum.ionicframework.com/u/nkhlshnd)\
**Post date:** [August 7, 2020, 2:32pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/12 "2020-08-07T14:32:55Z")

</div>

yes you are totally right

in app.module.ts

**import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic/ngx”;**  
providers: [  
…  
**FCM,**  
…

],

in app.component.ts

**import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic/ngx”;**

**private fcm: FCM,**

this.fcm.onNotification().subscribe(data =\> {

```
     console.log(data);

    if (data.wasTapped) {

      console.log('Received in background');

    } else {

      console.log('Received in foreground');

    }

  });

```

 ![bug](https://global.discourse-cdn.com/ionicframework/original/3X/b/4/b4fa9d65cd849077aa1fbdb5dd6f8c95c4ca65e4.png)

thank you so much

---

<div class="post-metadata">

**Author:** ![DMoney](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@DMoney](https://forum.ionicframework.com/u/DMoney)\
**Post date:** [August 24, 2020, 1:38am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/13 "2020-08-24T01:38:17Z")

</div>

I’m unable to import in the app.module using import { FCM } from ‘cordova-plugin-fcm-with-dependecy-updated/ionic/ngx’;

 ![Screen Shot 2020-08-23 at 9.37.13 PM](https://global.discourse-cdn.com/ionicframework/original/3X/a/5/a58c961f84d8b22d6599e4f2de43828d3a000d52.png)

I am able to get the token but this is in Develop mode and the poster said that it won’t work in prod. So I followed your comment and I can get the token but I can’t import into module.

---

<div class="post-metadata">

**Author:** ![akhilashok7539](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@akhilashok7539](https://forum.ionicframework.com/u/akhilashok7539)\
**Post date:** [October 29, 2020, 6:51am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/14 "2020-10-29T06:51:54Z")

</div>

> [@nkhlshnd](#):
>
> import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic/ngx”;

i got this error while using this  
import { FCM } from “cordova-plugin-fcm-with-dependecy-updated/ionic/ngx”;  
core.js:4197 ERROR NullInjectorError: R3InjectorError(AppModule)[FCM → FCM → FCM]:  
NullInjectorError: No provider for FCM!  
at NullInjector.get ([http://localhost:8100/vendor.js:38014:27](http://localhost:8100/vendor.js:38014:27))  
at R3Injector.get ([http://localhost:8100/vendor.js:48181:33](http://localhost:8100/vendor.js:48181:33))  
at R3Injector.get ([http://localhost:8100/vendor.js:48181:33](http://localhost:8100/vendor.js:48181:33))  
at R3Injector.get ([http://localhost:8100/vendor.js:48181:33](http://localhost:8100/vendor.js:48181:33))  
at NgModuleRef$1.get ([http://localhost:8100/vendor.js:61298:33](http://localhost:8100/vendor.js:61298:33))  
at Object.get ([http://localhost:8100/vendor.js:59201:35](http://localhost:8100/vendor.js:59201:35))  
at getOrCreateInjectable ([http://localhost:8100/vendor.js:41020:39](http://localhost:8100/vendor.js:41020:39))  
at ɵɵdirectiveInject ([http://localhost:8100/vendor.js:50852:12](http://localhost:8100/vendor.js:50852:12))  
at NodeInjectorFactory.AppComponent\_Factory [as factory] (ng:///AppComponent/ɵfac.js:6:7)  
at getNodeInjectable ([http://localhost:8100/vendor.js:41128:44](http://localhost:8100/vendor.js:41128:44))

---

<div class="post-metadata">

**Author:** ![hoangduy265](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hoangduy265/32/133827_2.png) [@hoangduy265](https://forum.ionicframework.com/u/hoangduy265)\
**Post date:** [October 30, 2020, 3:22am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/15 "2020-10-30T03:22:08Z")

</div>

you need import FCM to app.module.ts

---

<div class="post-metadata">

**Author:** ![akhilashok7539](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@akhilashok7539](https://forum.ionicframework.com/u/akhilashok7539)\
**Post date:** [October 31, 2020, 5:02am UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/16 "2020-10-31T05:02:57Z")

</div>

actulay iam import fcm in app.module.ts page in providers section but its not working

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [December 26, 2020, 6:49pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/17 "2020-12-26T18:49:12Z")

</div>

so there is problem in this way in ios so ifix it by using another plugin its

----\> firebasex plugin

---

<div class="post-metadata">

**Author:** ![derrickivan17](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@derrickivan17](https://forum.ionicframework.com/u/derrickivan17)\
**Post date:** [March 25, 2021, 6:44pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/18 "2021-03-25T18:44:21Z")

</div>

> [@alimuhnad](#):
>
> rebasex plugin

need help, i followed the steps above but has this error after running it,

ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘getToken’ of undefined  
TypeError: Cannot read property ‘getToken’ of undefined  
at FCM.push…/node\_modules/cordova-plugin-fcm-with-dependecy-updated/ionic/ngx/FCM.js.FCM.getToken (/vendor-es2015.js:114568)  
at AppComponent. (/main-es2015.js:1364)  
at Generator.next ()  
at fulfilled (/polyfills-es2015.js:5551)  
at ZoneDelegate.invoke (/polyfills-es2015.js:6047)  
at Object.onInvoke (/vendor-es2015.js:70734)  
at ZoneDelegate.invoke (/polyfills-es2015.js:6046)  
at Zone.run (/polyfills-es2015.js:5812)  
at /polyfills-es2015.js:6543  
at ZoneDelegate.invokeTask (/polyfills-es2015.js:6079)  
at resolvePromise (/polyfills-es2015.js:6485)  
at /polyfills-es2015.js:6395  
at fulfilled (/polyfills-es2015.js:5551)  
at ZoneDelegate.invoke (/polyfills-es2015.js:6047)  
at Object.onInvoke (/vendor-es2015.js:70734)  
at ZoneDelegate.invoke (/polyfills-es2015.js:6046)  
at Zone.run (/polyfills-es2015.js:5812)  
at /polyfills-es2015.js:6543  
at ZoneDelegate.invokeTask (/polyfills-es2015.js:6079)  
at Object.onInvokeTask (/vendor-es2015.js:70715)

did i miss something ? here’s my project ionic info

Ionic:

Ionic CLI : 5.4.1  
Ionic Framework : @ionic/angular 4.9.1  
@angular-devkit/build-angular : 0.803.24  
@angular-devkit/schematics : 8.2.2  
@angular/cli : 8.3.5  
@ionic/angular-toolkit : 2.0.0

Capacitor:

Capacitor CLI : 1.2.1  
@capacitor/core : 1.2.1

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)  
Cordova Platforms : android 8.1.0  
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 22 other plugins)

Utility:

cordova-res : 0.15.3  
native-run : 1.3.0

System:

NodeJS : v14.16.0 (D:\Node JS\node.exe)  
npm : 6.14.8  
OS : Windows 10

---

<div class="post-metadata">

**Author:** ![alimuhnad](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alimuhnad/32/140579_2.png) [@alimuhnad](https://forum.ionicframework.com/u/alimuhnad)\
**Post date:** [April 14, 2021, 3:32pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/19 "2021-04-14T15:32:55Z")

</div>

> [@alimuhnad](#):
>
> firebasex plugin

firebasex plugin use it

---

<div class="post-metadata">

**Author:** ![derrickivan17](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@derrickivan17](https://forum.ionicframework.com/u/derrickivan17)\
**Post date:** [April 14, 2021, 4:26pm UTC](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883/20 "2021-04-14T16:26:00Z")

</div>

i tried firebasex but can’t seem to work, i think it’s because of my version. i solved it by using OneSignal Push Notifications Instead

[Next page](https://forum.ionicframework.com/t/native-tried-calling-fcm-gettoken-but-the-fcm-plugin-is-not-installed-ionic-5/191883.md?page=2)
