Cannot read ios message from firebase push notification in ionic app - ios

I'm Just setting up push notifications for my app. They've been working welll on android for months and they display a toast when they come in while the app is open. I've been trying to enable them on ios and they're coming through in the background perfectly but when the app is open I can't read the content of the message. What I'm receiving is this:
{"google.c.a.c_l":"notification","google.c.a.e":"1","aps":{"alert":"local"},"gcm.n.e":"1","google.c.a.c_id":"63900123618947024","google.c.a.udt":"0","gcm.message_id":"0:1535060571041708%93cc4aea93cc4aea","google.c.a.ts":"1535060570","tap":false}
My guess is that the content is somehow stored in the gcm.message_id but I don't know how to access this. It seems like something that should be straight forward but I can't for the life of me figure it out!

Related

iOS Push notification using Firebase

I am working in a project where I need to show notifications fired by Firebase. Everything works fine with the send and receive flow. But I need to customise the notification before showing it, i.e., when the app is in background. Because the message I receive from our server it's already Base64 encoded. And therefore the notification displays a long string that my petrify the users.
Is there any delegate or something which I can use to modify the received data before presenting it when the app is in background?
Currently there is no way in iOS to do that. Please refer to this answer for more details How to change how a remote notification is presented before presentation?
You can use these following in your project to handle any data.
Works only for iOS 10.2 or greater
UNNotificationServiceExtension
UNNotificationContentExtension
Go through this link - https://medium.com/#prianka.kariat/ios-10-notifications-with-attachments-and-much-more-169a7405ddaf
As i have limited time please let me know if you need more explanation on this.
Debugging is also a tricky part in this First you go through this then try to debug by GO to DEBUG -> Attach to process by pid and paste your extension name you added.

React Native iOS send notification through receiving socket.io from the server in background mode

I am using react-native-notification module to send a local notification when I receive a socket.io event sent from the server. The notification is properly configured and works on both iOS and Android in foreground mode. However, due to the fact that Apple doesn't allow Apps to run on the background except for (Audio, navigation map, etc.), I am not able to receive any socket events when my app is not on the background and temporarily suspended.
I'm therefore not able to send a local notification to the iOS device since the app isn't really running once I switch the app to background.
Here I'm asking for possible solutions to my current problem.
This could be a general question regarding react native or iOS native.
Everything works well on Android devices and I don't think there is anything wrong with my code so I don't know what code I should display here.
In short, I just want to know how to receive socket events when the app is in the background on an iOS device, or if that can't be achieved. I would like to know how most apps even send notifications to their users when their apps are in the background.(I do not want to cheat the system and set the background mode to audio).
I know its a old post but if anyone still wondering, You can send notification even your app is closed or socket disconnected. You can use firebase push notification which will handle your current situation even if your app is killed.
Try below plugin to send notification to both android/ios without using any background service react-native-firebase

Query OneSignal server from device to get info about push notifications received while app was closed

I'm using OneSignal Swift in a native iOS application. So far i'm able to handle all kinds of push notification cases (foreground/background) except one. When user has force closed the application from "task bar switcher".
I'm using 'content-available':'true' in all my notifications through OneSignal in order to wake up my app and start running code the exact moment the notification is received. So far so good everything is working as expected.
When the app is closed and push notification arrives, if user taps it, then handling with OneSignal works with OSHandleNotificationActionBlock callback.
The problem though is if user doesn't tap and just opens through application icon, then notification data are completely lost. Online reference dictates that the correct way of handling this (what most apps like Facebook do), is query tour APNS (OneSignal in my case) for unhandled notifications and re-fetch them on application start. So the question is how to do that from OneSignal iOS native SDK? Is it possible? There is ofc the REST Service -which might be the case- but users are clearly discouraged to call the API from inside client application. An app key is necessary which shouldn't be saved in device's keychain apparently for security reasons(??)...

PushWoosh and PhoneGap/Cordova 3.1 for iOS

So I have an app I've built and works perfectly. I have all the provisioning done correctly and have it set to have push notifications. Now I am wanting to actually add the push notification feature.
I have my app added into my PushWoosh account and have configured it for iOS.
I referenced this page https://www.pushwoosh.com/programming-push-notification/ios/ios-additional-platforms/push-notification-sdk-integration-for-phonegap/ and completed everything.
At the bottom I don't understand the "Sample iOS push notification payload:" part. Maybe it's just a sample of what happens? But my biggest question is, where do I go from here? Is it ready for the app to be built, run, subscribe to push notifications, and test it out? After number 4 in that guide, there really isn't a next step to take.
you dont even need step 4 its just show you where you get the notification from(step 1 line 5-14)
the "Sample iOS push notification payload:" its what the notification data you get will look like
right now your app is ready to receive notification, open it in your iphone and send a notification from pushwoosh.
you will get a alert with the message, the alert is coming from line 10(in the docs)

send event from server to an ios app

I would like to know whether there is an alternative different than what I am thinking so far. I have an ios app, which gets data from my server, when the user clicks refresh button or so.
Now, I want to send data from server to the app - for example when an event started so as to update the label on that event.
I have thought of the following :
Use background fetch from my IOS app and connect to the server every an interval
Send a push notification and make the user open the app, and the app calls refresh
Is there any other way? Is it possible that server will send the data (just like a push notification) but without the notification to be visible, without firing the app, I just want to change some of its data - an approach similar to the Google Cloud Messaging for Android.
To visualise what I am saying, if you have used LiveScores app, it updates for example the minute of a live match - I want something similar.
I guess I need to follow approach 1, with background fetch (which became more effective in ios7) but just out of curiosity if there is any other solution out there.
Thanks
Under ios7+ you can do silent pushes (which aren't displayed) [see a nice tutorial — hayageek.com: iOS Silent Push notifications]
Under ios6 and below you are of of luck

Resources