# Notification not working when app is closed

**URL:** <https://forum.ionicframework.com/t/notification-not-working-when-app-is-closed/176598>\
**Category:** ionic-v3\
**Created:** [October 30, 2019, 9:01pm UTC](https://forum.ionicframework.com/t/notification-not-working-when-app-is-closed/176598 "2019-10-30T21:01:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![safaAlshaarri](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@safaAlshaarri](https://forum.ionicframework.com/u/safaAlshaarri)\
**Post date:** [October 30, 2019, 9:01pm UTC](https://forum.ionicframework.com/t/notification-not-working-when-app-is-closed/176598/1 "2019-10-30T21:01:33Z")

</div>

hi every one i have an app where i need to send notification it’s working very fine on emulator but on device it’s not working … it works when the app is opened but when it’s closed it don’t show  
here is the used code  
i used FMC provider

```auto
async getToken() {

    let token;
  
    if (this.platform.is('android')) {
      token = await this.firebaseNative.getToken()
    } 
  
    if (this.platform.is('ios')) {
      token = await this.firebaseNative.getToken();
      await this.firebaseNative.grantPermission();
    } 
    
    return this.saveTokenToFirestore(token)
  }
  // Save the token to firestore
  private saveTokenToFirestore(token) {
    if (!token) return;
  
    const devicesRef = this.afs.collection('devices')
  
    const docData = { 
      token,
      userId: 'user:'+this.deviceID,
    }
  
    return devicesRef.doc(token).set(docData)
  }

  // Listen to incoming FCM messages
  listenToNotifications() {
    return this.firebaseNative.onNotificationOpen()
  }

```

firebase  
“@ionic-native/firebase”: “^4.0.0”,  
“angularfire2”: “^5.0.0-rc.11”,  
“@ionic-native/background-mode”: “^4.20.0”,  
please help me  
thank u
