Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting background notifications on iOS #425

Closed
4 of 5 tasks
iconio opened this issue Jun 9, 2020 · 1 comment
Closed
4 of 5 tasks

Not getting background notifications on iOS #425

iconio opened this issue Jun 9, 2020 · 1 comment
Labels
ios relates to iOS platform runtime issue An issue related to app runtime support Support is being requested but not a necessarily a bug

Comments

@iconio
Copy link

iconio commented Jun 9, 2020

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:
Once the app in in background mode this shows up on XCode's console and I can't receive notification while the app is in background. If the app is in foreground the notification shows up without a problem.
I also have a log confirming that Notifications is enabled.

_hasPermission: YES

FirebasePlugin[native] LOG: FCM direct channel = false

FirebasePlugin[native]: FCM direct channel = false

Expected behavior:
To be able to receive push notifications when the app is on Background.

Environment information

Ionic:

   Ionic CLI                     : 6.10.0 (/Users/wd/.nvm/versions/node/v12.11.1/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.1.0
   @angular-devkit/build-angular : 0.803.26
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.2.0

Cordova:

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

Utility:

   cordova-res (update available: 0.14.0) : 0.8.1
   native-run (update available: 1.0.0)   : 0.3.0

System:

   ios-deploy : 1.10.0
   ios-sim    : 8.0.2
   NodeJS     : v12.11.1 (/Users/wd/.nvm/versions/node/v12.11.1/bin/node)
   npm        : 6.14.5
   OS         : macOS Catalina
   Xcode      : Xcode 11.5 Build version 11E608c

Related code:

// Check for Permission accordingly to documentation
if (this.platform.is('ios')) {
    token = await this.firebaseX.getToken();
    const hasPermission = await this.firebaseX.hasPermission();
    if (!hasPermission) {
        await this.firebaseX.grantPermission();
    }
}

Console output

console output

Ionic Native: deviceready event fired after 277 ms
2020-06-09 18:40:57.452323-0300 registerForRemoteNotifications
2020-06-09 18:40:57.452403-0300  _hasPermission: YES
2020-06-09 18:40:57.703922-0300 Metal GPU Frame Capture Enabled
2020-06-09 18:40:57.705922-0300 Metal API Validation Enabled
2020-06-09 18:41:12.096532-0300 FirebasePlugin[native] LOG: FCM direct channel = true
2020-06-09 18:41:12.105379-0300 FirebasePlugin[native]: FCM direct channel = true

When in background mode:

2020-06-09 18:54:44.351349-0300 FirebasePlugin[native] LOG: FCM direct channel = false
2020-06-09 18:54:44.622303-0300 FirebasePlugin[native]: FCM direct channel = false


Other information:
I want to to say thank you for this, this is amazing.

@dpa99c
Copy link
Owner

dpa99c commented Jun 10, 2020

The most likely cause of this issue is your APNS configuration since background notifications on iOS working fine for myself and other users of this plugin, indicating the issue is not caused by a bug in the plugin code.

Please use the example project as a known working codebase to validate your APNS configuration and read the Firebase documentation on setting up APNS in Firebase.

With regard to this:

FirebasePlugin[native]: FCM direct channel = false

This log message is irrelevant to background notifications as it concerns the (now deprecated) direct channel API which is only applicable while the app is in the foreground - see #406.

@dpa99c dpa99c closed this as completed Jun 10, 2020
@dpa99c dpa99c added ios relates to iOS platform runtime issue An issue related to app runtime support Support is being requested but not a necessarily a bug labels Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ios relates to iOS platform runtime issue An issue related to app runtime support Support is being requested but not a necessarily a bug
Projects
None yet
Development

No branches or pull requests

2 participants