Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova, Firebase, FCM Plugin - Not showing notifications in notification bar on iOS

I'm using this plugin with cordova: cordova-plugin-fcm to get notifications working.

It works good on Android.

Problem is with iOS, when the app is in foreground the notifications arrives. But when the app is closed or in background, the notification doesn't show in notification bar, but when I open the application I can see the notification arriving and the popup I generate, gets opened.

But I really need to notification to show in lock screen and in the notification bar.

This is what I'm sending to Firebase API:

/ POST to https://fcm.googleapis.com/fcm/send

And in the body I'm sending this:

{
  "to" : <USER_TOKEN>,
  "alert":"Test",
  "notification": {
    "alert":"Test test",
    "title": "Notification test",
    "text": "Testing notification text"
  },
  "priority": 10,
  "content_available": true
}

I've also tried with "priority": "high" and get the same results.

The notification arrives, but it only shows when I open the app. I don't even get it in the notification bar or lock screen.

Also I tried adding the "aps" property in the body, with all the information inside.. doesn't work.

I hope someone can throw some light into this..

PS: iOS v10.1.1

PS2: Works good on all android devices.

I've already read some answers from the community but doesn't seem to work:

Firebase API is not sending push notifications when using the API

iOS not receiving Firebase Push Notification sent through the API

Thanks for your time.

like image 617
Ariel Avatar asked Oct 17 '22 20:10

Ariel


1 Answers

have you Upload your Development APNs certificate on console.firebase.google.com,

Upload your APNs certificate to Firebase. If you don't already have an APNs certificate, see Provisioning APNs SSL Certificates.

Inside your project in the Firebase console, select the gear icon, select Project Settings, and then select the Cloud Messaging tab. Select the Upload Certificate button for your development certificate, your production certificate, or both. At least one is required. For each certificate, select the .p12 file, and provide the password, if any. Make sure the bundle ID for this certificate matches the bundle ID of your app. Select Save.

you can refer link https://firebase.google.com/docs/cloud-messaging/ios/client

like image 172
DIGAMBAR TOPE Avatar answered Oct 21 '22 05:10

DIGAMBAR TOPE