Not getting local notification in ios
See original GitHub issueNotice: ‘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:
- Created 6 years ago
- Reactions:4
- Comments:10 (1 by maintainers)
Top GitHub Comments
Is there any way to get the local notification showing on iOS when the app is in the foreground?
@JonoH You should implement it yourself in onNotification(), the simplest example is with alert() or toast (https://github.com/magicismight/react-native-root-toast).