0

There's a problem with my app and I don't know why: notification with Firebase doesn't work when the app is in the background, but they are fired once the app goes in the foreground. The problem is not how to handle them, but why when the app is in foreground notification popup are fired, but when are in the background not.

{ 
 "notification" : {
  "title" : "...",
  "body" : "...",
  "icon" : "...",
  "sound" : "default"
},
"to": "...",
  "priority" : "high",
"data" : {
   ...
}
}

This is a sample of the notification I tried to fire with the postman. Any ideas? Thanks

3
  • Can you change priority and check? And also please make sure that by mistake you are not sending content-availble true which results in silent push notification Commented Jul 10, 2017 at 14:41
  • i tried priority normal and also without the tag priority Commented Jul 10, 2017 at 14:51
  • solution's here stackoverflow.com/questions/38520645/… Commented Jul 10, 2017 at 15:30

2 Answers 2

2

1) Check your certificate and bundle identifier in Firebase.

2) Make sure you send Device Token to Firebase.

- (void)application:(UIApplication *)application
   didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

// For Development
    [FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];

// For Production
    [FIRInstanceID instanceID] setAPNSToken:deviceToken type: FIRInstanceIDAPNSTokenTypeProd];

    }

You can checkout this Link for more information.

Sign up to request clarification or add additional context in comments.

Comments

0

Check in capabilities You turned on Remote Notification in Background Modes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.