Is it possible to attach data to localNotificationSchedule?
See original GitHub issueQuestion
I don’t know if I am missing anything but this would solve a pain I’m going through now.
For example: how could I add the notification type (i.e. say entryNotification
or challengeNotification
) when scheduling the notification?
Then I could access it in the data prop in onNotification: notification => {}
Example
PushNotification.localNotificationSchedule({
/* Android Only Properties */
id: generatedId, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
// largeIcon: "@mipmap/ic_notif", // (optional) default: "ic_launcher"
smallIcon: "@mipmap/ic_notif", // (optional) default: "ic_notification" with fallback for "ic_launcher"
vibrate: true, // (optional) default: true
vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000
priority: "high", // (optional) set notification priority, default: high
visibility: "private", // (optional) set notification visibility, default: private
importance: "high", // (optional) set notification importance, default: high
allowWhileIdle: true, // (optional) set notification to work while on doze, default: false
ignoreInForeground: false, // (optional) if true, the notification will not be visible when the app is in the foreground (useful for parity with how iOS notifications appear)
/* iOS only properties */
alertAction: "view", // (optional) default: view
userInfo: {
id: generatedId,
}, // (optional) default: {} (using null throws a JSON value '<null>' error)
/* iOS and Android properties */
/* LOOKING FOR SOMETHING LIKE THIS */
data: {
notificationType: 'challengeNotification'
},
date: updatedDate,
repeatType: repeatType,
message: strings.DashboardComponent.challengeNotificationBody,
title: isCustomChallenge ? strings.DashboardComponent.customChallengeNotificationTitle : challengeObj.notificationTitle,
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
How to create local notification with an end date - Stack Overflow
For example: import PushNotification from 'react-native-push-notification'; PushNotification.localNotificationSchedule({ id: "1", message: "My ...
Read more >Scheduling a Notification Locally from Your App
Create and schedule notifications from your app when you want to get the user's attention. Overview. Use local notifications to get the user's...
Read more >react-native-push-notification - npm
NOTE: localNotification() works without changes in the application part, while localNotificationSchedule() only works with these changes:.
Read more >flutter_local_notifications | Flutter Package - Pub.dev
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
Read more >React Native Local Push Notifications | by Saad Khan - Medium
First, I am going to install the notification package. yarn add react-native-push- ... Don't forget to pod install for iOS. ... <meta-data ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just figured out that I can reach it by using the field
userInfo
😅This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.