Open hal-berto opened 5 months ago
In my case the push notification only arrives when I am in the background, when I am inside the app it does not arrive.
Does anyone know if it is a configuration issue that I am missing?
Strange thing is I tried with: -Test project provided with this same plugin -A clean cordova project with only firebasex plugin installed -A clean capacitor project with only the push plugin (in this case it's not the cordova-plugin-firebasex, but a similar one)
In all these cases I experienced same issue: notifications are not received when the app is closed... Isn't it a way to receive notifications on newer phones?
Here is a screen recording showing the test project built with the latest plugin version (v16.3.0) and cordova-android@12
running on a Google Pixel 5a.
It shows the app receiving push notifications while in the foreground, background and not running (task killed).
@hal-berto I notice your test device is an Asus. As outlined in https://github.com/dpa99c/cordova-plugin-firebasex/issues/235, some non-Google OEMs (including Asus) have issues receiving push notifications from FCM when the app is not running (vs running in the background). The proposed solution was to integrate the Autostarter library into this plugin. However it appears this library is no longer maintained (no update for 2 years) so maybe an alternative needs to be found which is maintained before making any integration with this plugin.
Bug report
CHECKLIST
[X] I have read the issue reporting guidelines
[X] I confirm this is a suspected bug or issue that will affect other users
[X] I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
[X] I have read the documentation thoroughly and it does not help solve my issue.
[X] I have checked that no similar issues (open or closed) already exist.
Current behavior:
Notification messages are received only when app is in foreground. If the app is in background or is closed, notifications are no more received.
Expected behavior:
Notifications should be received even if the app is in background or is closed
Environment information
Runtime issue
Related code:
In app.component.ts following code is executed in function ngOnInit():
The code in this.firebase.grantPermission() is ignored, no permission is requested and no logs are written in console (but it should be correct, at least if I correctly understood what's written in the documentation about plugin usage under Android).
I also tried to add following configuration in config.xml file:
With this configuration when application is executed on recent phones (android 13+) a message appears asking to give permission to receive notifications, but nothing changes. Even with permission granted, no notification is received when app is in background.
Other information:
This issue seems to be present in recent versions of cordova platform. In apps developed with older versions of cordova (for example cordova 6.3.0) notifications are received.