# Enable push notification with Firebase

**URL:** <https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245>\
**Category:** Ionic Framework\
**Created:** [December 10, 2021, 12:06pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245 "2021-12-10T12:06:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsantaniello](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@lsantaniello](https://forum.ionicframework.com/u/lsantaniello)\
**Post date:** [December 10, 2021, 12:06pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/1 "2021-12-10T12:06:48Z")

</div>

I need to enable my ionic5 app to receive firebase push notification.

There are 2 different plugins:

- @awesome-cordova-plugins/firebase
- @awesome-cordova-plugins/fcm

There is a lot of confusion.

I understood that '@awesome-cordova-plugins/firebase ’ is generic and it enables all firebase features.

"@awesome-cordova-plugins/fcm " instead enables only the messaging features.

it’s correct?

What do you recommend?

---

<div class="post-metadata">

**Author:** ![Aprime](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Aprime](https://forum.ionicframework.com/u/Aprime)\
**Post date:** [December 10, 2021, 2:09pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/2 "2021-12-10T14:09:33Z")

</div>

I wouldn’t use either. You only need the firebase npm package, no need to go through one that is specific to cordova, capacitor or even ionic.

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 10, 2021, 2:39pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/3 "2021-12-10T14:39:29Z")

</div>

There is an official Capacitor plugin for push notifications maintained by Ionic - [`@capacitor/push-notifications`](https://capacitorjs.com/docs/apis/push-notifications).

There is also a good tutorial here as well - [Using Push Notifications with Firebase in an Ionic + Angular App](https://capacitorjs.com/docs/guides/push-notifications-firebase).

The advantage of using the Capacitor plugin over the firebase npm package, is that you’ll get native notifications on the device when your app is not running or in the background. If the app is in the foreground, you need to use it in conjunction with [Local Notifications](https://capacitorjs.com/docs/apis/local-notifications) if you still want the native notificaiton. Otherwise, you can do an in-app notificaiton.

---

<div class="post-metadata">

**Author:** ![Aprime](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Aprime](https://forum.ionicframework.com/u/Aprime)\
**Post date:** [December 11, 2021, 12:51am UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/4 "2021-12-11T00:51:55Z")

</div>

That’s not true, have you tried it? I get app notifications even if the app isn’t running in the foreground.

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 11, 2021, 2:02pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/5 "2021-12-11T14:02:09Z")

</div>

I have not tried the `firebase` package. I assumed it doesn’t hook into native. I stand corrected if it does 🙂 Does it work if the app is not running at all?

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [December 11, 2021, 2:43pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/6 "2021-12-11T14:43:03Z")

</div>

Well the web api uses service workers so that triggers a notification even if in background

Issue though is that the web only api does not work on iOS. So that imho calls for a capacitor or cordova implementation

---

<div class="post-metadata">

**Author:** ![lsantaniello](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@lsantaniello](https://forum.ionicframework.com/u/lsantaniello)\
**Post date:** [December 16, 2021, 9:32pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/7 "2021-12-16T21:32:52Z")

</div>

i don’t understand which library to use to enable receiving firebase notifications. can you help me?

Tried to use “cordova-plugin-fcm-with-dependecy-updated” but it generate building error on ios

Help me please

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 17, 2021, 12:13am UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/8 "2021-12-17T00:13:19Z")

</div>

> [@twestrick](#):
>
> There is an official Capacitor plugin for push notifications maintained by Ionic - [`@capacitor/push-notifications`](https://capacitorjs.com/docs/apis/push-notifications).
> 
> There is also a good tutorial here as well - [Using Push Notifications with Firebase in an Ionic + Angular App](https://capacitorjs.com/docs/guides/push-notifications-firebase).

The Capacitor plugin includes the Firebase SDK for you on Android. For iOS, you need to include it via CocoaPods. The tutorial walks you through it.

---

<div class="post-metadata">

**Author:** ![lsantaniello](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@lsantaniello](https://forum.ionicframework.com/u/lsantaniello)\
**Post date:** [December 17, 2021, 9:08am UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/9 "2021-12-17T09:08:33Z")

</div>

Thanks @twestrick but I use cordova, not Capacitor. Is it the same?

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 17, 2021, 2:27pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/10 "2021-12-17T14:27:53Z")

</div>

I can’t speak on a Cordova plugin. Have you thought about converting to Capacitor? Capacitor seems to be the future. Many Cordova plugins also work with Capacitor.

---

<div class="post-metadata">

**Author:** ![lsantaniello](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@lsantaniello](https://forum.ionicframework.com/u/lsantaniello)\
**Post date:** [December 18, 2021, 4:40pm UTC](https://forum.ionicframework.com/t/enable-push-notification-with-firebase/218245/11 "2021-12-18T16:40:31Z")

</div>

I am worried about the migration because the development of the app is almost finished ☹
