bug: PushNotifications on Android, if the app is killed will not show
See original GitHub issueBug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 2.4.0
@capacitor/core: 2.4.0
@capacitor/android: 2.4.0
@capacitor/electron: 2.4.0
@capacitor/ios: 2.4.0
Installed Dependencies:
@capacitor/cli 2.4.0
@capacitor/core 2.4.0
@capacitor/android 2.4.0
@capacitor/ios 2.4.0
@capacitor/electron not installed
Platform(s)
- Android 10
Current Behavior
The push notifications (setup via tutorial) and send via firebase console do not work if the application is closed (not minimized) on the phone.
Expected Behavior
The sent push notifications should be in the system tray.
Code Reproduction
Other Technical Details
npm --version
output: 6.12.1
node --version
output: v12.13.1
pod --version
output (iOS issues only): –
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:14
Top Results From Across the Web
Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >android - Push not received when app is killed - Stack Overflow
I've noticed that I get different behaviour depending on how the app was launched before I swiped it closed, as bizarre as that...
Read more >Android device cannot receive push notifications when an ...
Android device cannot receive push notifications when an application is force stopped ("killed") · Go to Settings > Apps & Notifications > enable...
Read more >Notifications Not Shown - Mobile Push
Common reasons why Mobile Push notifications are not showing on your device. ... When an app is in a Force Stopped / Force...
Read more >Push Notifications Capacitor Plugin API
Android . This plugin does support data-only notifications, but will NOT call pushNotificationReceived if the app has been killed. To handle this scenario, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, it seems that the phonegap push plugin had a custom implementation for handling data only pushes. Then it makes sense for me too see this behaviour when sending the payload as i described above.
So for anyone with the described problem verify that youre not sending data only pushes as they wont trigger the notification when the app is closed or in the background.
I think some better documentation on the capacitor site would prevend users for this … huh moment. Some payloads examples would help and as a side note notice that data only pushes dont trigger the notification when the app is closed or in the background.
receiving message in the background and when the app was close on Android works with capacitor push plugin ony if you send the following firebase cloud message payload:
See here: https://firebase.google.com/docs/cloud-messaging/concept-options?hl=en