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.

Not getting local notification in ios

See original GitHub issue

Notice: ‘NOTIFICATION:’, { foreground: true, userInteraction: false, message: ‘My Notification Message’, data: {}, badge: 0, alert: ‘My Notification Message’, sound: ‘default’ }

I get above values in the log but I am not getting any local notification in the emulator tray.

`
componentDidMount() { PushNotification.configure({

// (optional) Called when Token is generated (iOS and Android)
onRegister: function(token) {
    console.log( 'TOKEN:', token );
},

// (required) Called when a remote or local notification is opened or received
onNotification: function(notification) {
    console.log( 'NOTIFICATION:', notification );
},

// ANDROID ONLY: GCM Sender ID (optional - not required for local notifications, but is need to receive remote push notifications)
senderID: "YOUR GCM SENDER ID",

// IOS ONLY (optional): default: all - Permissions to register.
permissions: {
    alert: true,
    badge: true,
    sound: true
},

// Should the initial notification be popped automatically
// default: true
popInitialNotification: true,

/**
  * (optional) default: true
  * - Specified if permissions (ios) and token (android and ios) will requested or not,
  * - if not, you must call PushNotificationsHandler.requestPermissions() later
  */
requestPermissions: true,

});
PushNotification.localNotification({ userInteraction: true, alertAction: ‘default’,// (optional) default: view /* iOS and Android properties */ title: “My Notification Title”, // (optional, for iOS this is only used in apple watch, the title will be the app name on other iOS devices) message: “My Notification Message”, // (required) actions: ‘[“Yes”, “No”]’ // (Android only) See the doc for notification actions to know more }); } `

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
JonoHcommented, Jul 26, 2017

Is there any way to get the local notification showing on iOS when the app is in the foreground?

5reactions
alveligcommented, Aug 27, 2017

@JonoH You should implement it yourself in onNotification(), the simplest example is with alert() or toast (https://github.com/magicismight/react-native-root-toast).

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 10 Local Notifications not showing - Stack Overflow
1 Answer 1 · Make sure you have the permission. If not, use UNUserNotificationCenter.current().requestAuthorization to get that. Or follow the answer below if ......
Read more >
Local Notification not working in Background Mode
When app is in background, notifications wont show. After investigating this issue i found that they work fine when app is running in...
Read more >
Quick guide on local notifications for iOS - tanaschita.com
Learn how to schedule local notifications in different ways and how to handle them. · Get user's permission · Create the content of...
Read more >
An iOS 11 Local Notification Tutorial - Techotopia
Contents · Creating the Local Notification App Project · Requesting Notification Authorization · Designing the User Interface · Creating the Message Content.
Read more >
Local Notifications in iOS 10 - James Rochabrun - Medium
If you open the app and then you press CMD + SHIFT + H to send it to the foreground again, you will...
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