Skip to content

bug: Push Notification not receiving in IOS when APP is in background #858

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

Closed
5 of 17 tasks
rajendra16 opened this issue Apr 23, 2025 · 7 comments
Closed
5 of 17 tasks

Comments

@rajendra16
Copy link

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Functions
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

7.1.0

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

In IOS push notification not receiving in background .
In foreground it is receiving.

Expected behavior

Push Notification in background should received in IOS

Reproduction

https://github.com/rajendra16/Push-Notification

Steps to reproduce

Do dependencies Installation using : npm install

Add IOS Platform : ionic capacitor add ios

Start Build Process : ionic build

Sync : npx cap sync

copy : npx cap copy

Follow these commands and create build using xcode

Other information

No response

Capacitor doctor

Latest Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Installed Dependencies:

@capacitor/cli: 7.2.0
@capacitor/android: 7.2.0
@capacitor/core: 7.2.0
@capacitor/ios: 7.2.0

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.
@rajendra16 rajendra16 added bug/fix Something isn't working needs: triage labels Apr 23, 2025
@robingenz
Copy link
Member

robingenz commented Apr 23, 2025

Please share the code you use to send the push notification. Please also share a screen recording which shows how you receive the push notification in foreground but not in the background.

@rajendra16
Copy link
Author

Dear Robin ,

PFA for notification received in foreground .

Image

For sending push notification from backend server

  1. API : A http post API call with given payload

             method: 'POST',
             url: https://fcm.googleapis.com/v1/projects/rajendra-1075c/messages:send,
             headers: {
                 'Content-Type': 'application/json',
                 'Authorization': 'Bearer ' + token
             },
             body: JSON.stringify(payload)
    

payload =>

{
"message":{
"topic":"ios",
"notification":{
"title":"TOPIC CALL 5 Testing",
"body":"NSE EQUITIES HDFCBANK EQ"
},
"data":{
"notId":"A4562",
"title":"RESEARCH CALL 11",
"message":"NSE EQUITIES HDFCBANK EQ",
"topicNo":"UID_WAVE211",
"topicName":"UID_WAVE211",
"masterRecoId":"",
"recoSubType":"101",
"slprice":"",
"sqprice":"",
"qty":"10",
"endTime":"09Aug2024 23:59:00",
"recoId":"08AWAAHAAA",
"analysisReportURL":"https://google.com",
"action":"SELL"
}
}
}

Copy link
Contributor

This issue has been labeled as needs: reproduction. This label is added to issues that need a code reproduction.

Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so we can debug the issue.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for us to reproduce the issue.

@rajendra16
Copy link
Author

Dear Robin

Please find below GitHub link to address the issue .

https://github.com/rajendra16/Push-Notification-Vanillajs-Capacitor7

@robingenz
Copy link
Member

@rajendra16 This example app does not even have the iOS platform.

@rajendra16
Copy link
Author

Dear Robin ,

Kindly follow given steps :

npm install

npx cap add ios

npm run build

npx cap sync

npx cap copy

After this steps open xcode and launch this workspace , Make build and verify the issue .

@robingenz
Copy link
Member

@rajendra16 You need to configure the iOS platform correctly to receive push notifications in the background. I cannot find any potential issues in your app when doing this myself. Therefore, I am closing this issue as you have not provided a fully reproducible example.

@robingenz robingenz closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants