question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No background notifications on IOS // Version 5.0.2

See original GitHub issue

Hi,

so far everything works fine but I don’t get background notifications on ios. If I start the app - the notifications are delivered and shown with the local notifications plugin. Remote Notifications are activated in the apropriate Xcode Project (and “UIBackgroundModes” in Info.plist , too).

In main.ts (before bootstrap) I have the following code. My expectation is that the local notification is shown even if the app is in the background. What I am missing? Any help would be appreciated!!!

firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs and 'iOSEmulatorFlush' to flush token before init. iOSEmulatorFlush: true, onPushTokenReceivedCallback: function(token) { console.log("Firebase push token: " + token); }, onMessageReceivedCallback: function(message) { console.log("scheduling test notification.."); LocalNotifications.schedule([{ id: 1, title: 'New Local Test Title', body: 'New Local Test message', ticker: 'The ticker', badge: 5, groupedMessages:["The first", "Second", "Keep going", "one more..", "OK Stop"], //android only groupSummary:"Summary of the grouped messages above", //android only ongoing: true, // makes the notification ongoing (Android only) smallIcon: 'res://heart', sound: "customsound-ios.wav", // falls back to the default sound on Android at: new Date(new Date().getTime() + (1 * 1000)) // 10 seconds from now }]).then( function() { console.log("Notification scheduled"); }, function(error) { console.log("scheduling error: " + error); } ); } }).then( (instance) => { console.log("firebase.init done"); }, (error) => { console.log("firebase.init error: " + error); } );

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:54 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
indianazhaocommented, Feb 4, 2018

After I add "click_action":"FCM_PLUGIN_ACTIVITY" into the payload and the function onMessageReceivedCallback now can be triggered after user click the notification message.

{
  "to": "/topics/hotnews",
  "notification": {
    "title":"Finally...",
    "body":"I got the push notification!",
    "click_action":"FCM_PLUGIN_ACTIVITY"
  },
  "data": {
    "foo": "More info..."
  }
}
2reactions
p-3commented, Feb 3, 2018

@indianazhao i had same exact the same issue before it did re-create all my apple certifications. are you sure that all certifications is valid and correctly installed?

Check out https://www.youtube.com/watch?v=LBw5tuTvKd4 how do fix the certifications, you can skip the swift parts in the video.

Eddy fixed:

  • require the plugin before the app starts
  • run ‘init’ after the app has started

in the app.component.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pushing Background Updates to Your App - Apple Developer
A background notification is a remote notification that doesn't display an alert, play a sound, or badge your app's icon. It wakes your...
Read more >
iOS 16 Not Showing Notifications on Lock screen! [Not Getting]
After the iOS 16 update, not getting Notification alerts on iPhone, or not showing notifications Preview when Screen Lock or Unlock?
Read more >
WhatsApp Notifications Not Showing on iPhone After iOS ...
WhatsApp notification not showing up on iPhone home screen, lock screen or notification center on iPhone, especially after the new iOS 16 ...
Read more >
Notifications Not Shown - Mobile Push
Common reasons why Mobile Push notifications are not showing on your device. ... Android,iOS: In your Device Settings > Notifications > Your App, ......
Read more >
Enable the Push Notification service for your iOS app
1. The App ID is used to identify your app and ensures the Apple push notification Servers will properly send push notifications to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found