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)
Related
This bounty has ended. Answers to this question are eligible for a +500 reputation bounty. Bounty grace period ends in 5 hours.
Scorb wants to draw more attention to this question.
I have a cross platform flutter app. I am using FCM to send notifications and they are not arriving on the iOS app in any state (foreground, background, terminated). I am testing on a physical device.
The notifications work on Android, so I know the topic subscription and send code is correct.
I have followed these steps for configuration defined here...
https://firebase.flutter.dev/docs/messaging/apple-integration/
To verify I have:
added and initialized firebase using google-services-info.plist.
created and added my APNS key
created the app identifier in the Apple Developer center and confirmed it matches my apps bundle id (and added push notification
capability for the identifier.
added push notification capability to the app in xcode
added background fetch and background remote notification capabilities to the app in xcode.
It seems like I have addressed every step to configure FCM on iOS. But none of my notifications arrive.
When the app is minimized, no system tray notification is triggered, and when in the foreground the FirebaseMessaging.onMessage is never triggered, like is is when on Android.
An important note is that this is the second iOS app added to this project, and the first iOS app works correctly. Though there is no indication that there are any special steps for a second app.
We saw a similar problem (for a native iOS app) where FCM would deliver to one app in the project but not the other. The mistake we made was not repeating the configuration in Firebase for the other apple bundle id since each app in our project has a different bundle id. Given it works for one of your iOS apps but not the other on the same project, it sounds like you've got the same issue.
Also, a good diagnostic step is to use the Firebase Console to manually send off a Push Notification to a particular app. It means you can then discount errors further upstream in your backend that may not have caused FCM to be invoked.
Have you tried to send testing notifications via firebase console?
You can log your device token in your app.
Background notification must work if you have done correct with firebase and APN settings despite without implementing some methods of AppDelegate file for remote notification on the next step.
Your question is very blur to have a specific answer but you can separate your concerns to find the issue and then try to resolve that:
1. Make sure about the APNs configuration
First, try to send a notification to your iOS app, directly using the APNS key. If you get the notification, it means you have configured the APNS correctly
2. Make sure about the firebase setup
Check with both the Android and iOS app and see if there are connected to the firebase console. You can use the real-time event to confirm that.
3. Make sure you have implemented the correct methods.
Firebase and apple have different methods for push notifications. Make sure you are implementing the correct one. Also, it may vary based on the configuration file of firebase. search for iOS firebase swizzling for more information
4. Make sure you got the right permissions from the user
You should get the notification permission from the user before trying to show any notification. Make sure you've done that
Note that you may have already tried some of these but I've mentioned them for the sake of completeness. Hope it helps you and others.
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!
I basically want to make multiple push notifications in the same application visible in the notification tray in iOS.
This scenario works if my data is on while push notification is triggered via APNS, but only the latest one is received in case I am offline and come back after a while. This functionality is affirmed by APNS documentaion.
However, this is what worked in WhatsApp:
Turned Data Connection OFF
Sent some messages to WhatsApp
Turned Data Connection ON
Saw multiple push notifications received in Apple's Notification Tray
How's this scenario working? Can I use APNS for this? If yes, then how?
See this sample image of multiple Push Notifications in WeChat.
Like you wrote in your question, this is mentioned in the Apple Docs:
If you are sending multiple notifications to the same device or
computer within a short period of time, the push service will send
only the last one.
Link
The only scenario that what you're describing will work is if your whatsApp was open in the background while getting those push notifications. That way whatsApp will handle them as local notifications and will present all of them in the notification center. If whatsApp was closed you'd get only the last notification like any other app.
You can easily test this:
Terminate whatsApp and turn on Airplane mode.
Send your device 5 messages from 1 to 5.
Turn Airplane mode off and lock your device.
You'll only see one msg (the last one you sent aka "5") in your notifications center.
This is how whatsApp is making it work:
While whatsApp is in the background, a single push notification is received (the last one the user sent, "5" in our example). That msg will not be shown to the user.
whatsApp receives it in the method application:didReceiveRemoteNotification:fetchCompletionHandler: and checks against their servers if there are any notifications prior to "5" that the user didn't receive. If that's the case, they will pull that data from their servers and will present it to the user using local notifications which is basically just a way to present data and not related to APNS at all.
It is explained in Troubleshooting Push Notifications. Check for "Some Notifications Received, but Not All" section.
As described you cannot have any control over those push notifications.
However you may know that from iOS7 a new background execution mode (remote-notification) allows the App to be awaken by the system when a push is received, allowing you to process some data, then go back to sleep...
This is probably the trick: using that way to receive the push notifications (silently) and then trigger your own local notification instead as #Segev said. See the UIBackgroundModes here.
The strangest thing has been bothering me for ages now. When sending a push notification from our sandbox environment the system receives the notification only when the app is in the foreground. Exiting the app and sending a push notification doesn't show a badge or alert.
These are the steps i've taken so far:
Re-created the provisioning profile after generating the SSL.
Made sure that the correct capabilities are in place.
Verified that a device token is registered
Does anyone have any idea what could be the problem here? Why would the push notification get received inside the app, but not outside?
How to show a local notification alert or a local notification banner when App is closed (either in the background or foreground), I can only modify the badge number when the app is closed...
You will not be able to present notifications while the app is in the background unless you implement Push Notifications with APNS and use UIRemoteNotification. Based on your experience and the scope of the project, it may be a bit complicated, but here is a good reference on getting started:
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
As of the writing of this answer, using iOS 8.4 (soon iOS9), you CAN
Display UILocalNotifications when the app is closed
Display push notifications whenever you want.
If your local notification is scheduled, it WILL fire, wheter or not the app is foreground/background/killed.
So now, your problem is this one : How do I schedule a local notification when the app is forground/background/kill ?
It's easy, in the Appdelegate, you can simply follow any tutorial and type your code there, it's pretty straightforward. The only different thing is, if the app is killed, you can't execute code unless the app is awaken with a push notification. And that's where the remote push notifications are useful, you can awaken your app (and execute code) with a push notification and do whatever you need from here on out.
You could :
- Display the content you want with the actual push notification. " You have 1 new message! "
- Send a "silent" push notification (invisible by the user) that still awakens your app, and execute code there, for example to update data or modify stuff in your app in general. If I'm not mistaken you're only allowed 15 minutes of work and a certain amount of data transfer when the app is awaken like that, but that has to be verified.
I hope I helped :)