3

I want to implement the FCM Push Notification service for a chat app, I follow the step in the Firebase doc , Im getting notifications when they are sent from the Firebase console to my device. When I try to send the notification using my server side to the device through FCM using http post to https://fcm.googleapis.com/fcm/send :

my headers are :

Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

my body is :

{ "notification": {
    "title": "Portugal vs. Denmark",
    "text": "5 to 1"
  },
  "to" : "myDeviceRegistrationId"
}

When my app is in background , nothing is happening (I repeat myself but with the console, I am getting the notification in background )

When the app is active and I am sending this notification to my device, Im getting the following message in my console Log, So I suppose that I am getting the notification but for some reason its not displaying it in background

Message ID: 0:1470132526023119%8d989dbf8d989dbf
        %@ [aps: {
            alert =     {
                body = "5 to 1";
                title = "Portugal vs. Denmark";
            };
        }, gcm.message_id: 0:1470132526023119%8d989dbf8d989dbf]
        2016-08-02 13:08:46.913 ProjectAlpha[13324:4726432] Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.

what am I missing ? thanks for your help..

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
jerem
  • 1,016
  • 2
  • 12
  • 27

2 Answers2

2

Did you active background mode?

Look this

breno
  • 230
  • 2
  • 15
0

I fixed my issue by deleting the

FirebaseAppDelegateProxyEnabled

key from Info.plist and using

"content_available": true

to receive messages while application is in background.

Now it works perfectly :)

zakaria
  • 365
  • 2
  • 5
  • 12