I am using react-native-push-notification to implement push notifications, I have followed the documentation properly when I send remote notification OnNotification() get called properly but when I send LocalNotification using PushNotification.LocalNotification() I get proper notification pop-up but it doesn't trigger OnNotification() function, I have gone through lot of stackoverflow questions and git issue still no solution, can anyone have solution have on this issue that would be great help
For ios this method will trigger/callback when you click on the notification and launch the app from killed state
PushNotificationIOS.getInitialNotification().then(notification => {
if (!notification) {
return;
}
});
I just implemented and tested in release mode, it worked well. For Andriod i'm still figuring it out which method triggers the call back in killed state.
Note: Above code works only in release mode for iOS.
Related
I am working on a React Native app that uses TalkJS. We want users to get a push notification for every message they receive. The messages are going through but we aren't getting notifications. We have uploaded our .p12 to the TalkJS dashboard and followed the docs for setting up a React Native project. Below is the relevant code we're injecting to the TalkUI loadScript. We followed https://talkjs.com/docs/Features/Notifications/Mobile_Push_Notifications.html
const res = await window.talkSession.registerDevice({ platform: "ios", pushRegistrationId: "${deviceToken}"});
alert("registering deviceToken ${deviceToken} response: " + res)
We are getting the alert with the correct deviceToken but this method does not return anything. We tried .then and an error first callback but nothing is coming back from this method.
Edit: this method is not designed to return anything, so the response is expected to be empty.
The Promise was designed to not return anything as Kapobajza mentioned.
From their support chat: "We have an issue regarding push notifications on iOS when using React Native."
Edit: this issue has been resolved. In addition to work that needed to be done by the TalkJS team, push notifications require a user to have a 'role', as is very loosely implied in the Overview for Push Notifications
I am using react native and trying to add push notification.
My application need push notification because of chatting. I just need push notification to appear whenever the user receives chat message.
I've searched couple of libraries about push notification and found out firebase and react-native-push-notification.
Which one is proper library for this case and please tell me if there is other better way to solve this problem.
We're using invertase firebase notification library which is working so far better without any issues.
You'll get almost all the options which you needed for push notification customization like badges, etc.
While trying to subscribe new ios device to Mobile first push notification using hybrid application , function WL.Client.Push.onReadyToSubscribe not getting fired
any help ?
Please apply this sample and see if the same issue is occurring.
If you still cannot subscribe, please provide xcode logs.
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/notifications/push-notifications-overview/push-notifications-native-ios-applications/event-source-based-notifications-in-native-ios-applications/
fixed , while checking native code , i found didRegisterForRemoteNotificationsWithDeviceToken method is exits which override WL registration process
just i removed it and it is working ok with me
I've just bought Distriqt ANE pack and can't get Push Notification worked for some case.
When application isn't started and I receive PN it shows in notification area, but when I try to open app from notification centre ( clicking by notification ) I can't get access to PN which opened application.
I've read documentation and asked Distriqt support but with no luck.
In docs we have:
Not running: A notification is displayed in the notification area.
When clicked the application is started. When you call register()
you'll immediately receive the notification event.
Support team answered:
You need to make sure you add the listener for notifications before
you call register. You should receive the notification immediately
when you call register if the application was started from the
notification center
My code:
PushNotifications.init( PN_DEV_KEY ); //it doesnt init for 2nd time!
if(PushNotifications.isSupported) {
PushNotifications.service.addEventListener( PushNotificationEvent.REGISTERING, onPnRegistering );
PushNotifications.service.addEventListener( PushNotificationEvent.REGISTER_SUCCESS, pnRegisterResult );
PushNotifications.service.addEventListener( PushNotificationEvent.UNREGISTERED, pn_unregisterSuccessHandler );
PushNotifications.service.addEventListener( PushNotificationEvent.NOTIFICATION, onPushNotification );
PushNotifications.service.addEventListener( PushNotificationEvent.FOREGROUND_NOTIFICATION, onForegroundNotificationReceived );
PushNotifications.service.addEventListener( PushNotificationEvent.ERROR, pn_errorHandler );
var registerResult:Boolean = PushNotifications.service.register(GCM_SENDER_ID);
But after register call no event has fired. It just do standard register routine and that's it.
Please help!
This feature was only added in one of the more recent releases. Always try to update your extensions before reporting a bug.
Thanks
Just updated to the latest version 2.6.iOS.2.1 from GitHub
and it works just fine.
I have an iPad app in the App Store whose logic relies largely on local notifications. In other words, much that happens inside the app is triggered by the delegate method application didReceiveLocalNotification.
With today's release of iOS 5, I see that apps can be placed (via Settings) either "In Notification Center" or "Not In Notification Center." I haven't found anything in the new documentation so far, but I'm hoping there is a way to have my app "In Notification Center" by default, (and possibly even set Sounds active and the notification type to Alert) which would save me having to explicitly explain to new users that after they download & install my app, they will have to manually go and elect for the app to be "In Notification Center."
Anyone know if this is possible? Seems that since an app can register a local notification, it should be able to receive it, by default (whether it displays an alert or an item in the new Notification Center, or not). Thanks in advance.
I've encountered the same problem. The only clue I saw in documentation is that the new Notification Center handles both local and remote notifications. Therefor I assumed that the app should register for local as it would for remote notification. Added this piece of code -
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
and after my app scheduled a local notification it appeared at the "In Notification Center".
BUT it seems to have no affect if my app already appears in "Not In Notification Center".. So have all of my customers that ran the app before the next update got screwed?
Currently it seems not.
I'm in a similar situation. I'd love to be wrong about this but I've found no mention of any such API (for specifying that a local-notification using app should appear in notification center by default) in any of the places I'd expect it to be:
Local and Push Notification guide
UIApplication class reference
UIKit Info PList keys
UIApplicationDelegate Protocol reference