notifications not received from Firebase - ios

A FCM firebase notification push message was received from the remote message function but does not push on my device. I have set the firebase proxy delegate to yes.

Rembember that push notification not showing on Simulator and when the app is running, just hide app and try send a new notification.

You need to make sure certain things.
You are not testing in a simulator. Notifications are not allowed there.
Payload used to be proper. https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html
Permission for notification should be given.

Related

Can i receive messages with FCM without notification permission?

I want to know if I can receive payload from FCM in my iOS app, even if the user doesn't allow notifications for my app. I don't want to show them as notifications, i just want to handle their payload.
Does background messaging work without permission?
Does foreground messaging work without permission?
The Firebase Cloud Messaging APNs interface uses the Apple Push Notification service (APNs) to send messages up to 4KB in size to your iOS app, including when it is in the background.
Notification permission is required for both background and foreground work (even if your push notification is a silent one i.e no notification needs to be displayed)
You still need the user to allow the notifications, later on, you can implement the handling as silent or not, up to you.
In order to receive the payload you need, it must come from a push notification.

Firebase/APNS Notification not receiving after ios app update

We implemented Push notification in our project with Firebase notification. Our current app (which is available in market) is receiving the notification and showing the notification in device (Badge, Alert). When we override the existing application with the new update (With new updated payload), the app getting new "Device Token" and the device not showing the push notification at anytime. Even, the firebase delegates getting called when the app is in foreground.
We tried the old app Firebase device token in the new update app. We are receiving the push notification perfect.
We tried the new device token in the new updated app. We are not receiving the push notification at any time. Also, we are receiving
two different device tokens.
Rechecked the "GoogleService-Info.plist" and the configurations are perfect.
Can anyone help on this? Thanks in advance.
Try to add FirebaseAppDelegateProxyEnabled in your info.plist file.
FirebaseAppDelegateProxyEnabled = YES
Hope this helps.

How to get all the push notification payloads after an iOS app launches or did become active

I have an app to work on. And I need to know if there is already some push notifications before the app is opened. Is there a way to solving the issue?
Thanks
You can't push a notification to a device when your application hasn't been opened at least once - the user has to authorize push notifications and you need get the push token value - returned after calling registerForRemoteNotifications - and send it to your server.
There's no guarantee that your app will see multiple push notifications if they all arrived when the application wasn't running. Often you'll just see the most recent notification. You should store all of the notifications on your server and have your application request them when it becomes active if there's at least one notification waiting for you.
Once you've registered for notifications you need to setup didReceiveRemoteNotification method in your AppDelegate. There you can handle any information received from a Push Notification. Here's a link to there relevant documentation.

End-to-end tracking of ios push notification [duplicate]

I build xcode app that get push notification, the main problem is that the push notification is very critical for me.
so I want to check if the push notification is delivered to the device with the app installed, I understand that if the iphone dosn't have internet connecction / 3G the push notification is not getting to the device.
how can I check if the device get the notification or not?
how can I check if the APNS successful to deliver the push notification?
I want to send sms if the push notification is not deliver to the device so I think about the idea to get the notification event when it's open by the push notification, and to send request to my server so i can know if the push notification is successful deliver or not. the main problem is that the user need to open the app every time he get the notification and in the night it's a problem. so this option is not good for me.
I check the feedback server push notification but i don't find any info that I can get if the push notification is delivered or not
any idea??
With iOS7 you have a new method called
application:didReceiveRemoteNotification:fetchCompletionHandler:
which you probably could use for your task. From Apple's Docs:
Implement this method if your app supports the remote-notification background mode.
...
When a push notification arrives, the system displays the notification to the user and
launches the app in the background (if needed) so that it can call this method. Use this
method to download any data related to the push notification. When your method is done,
call the block in the handler parameter.
Unlike the application:didReceiveRemoteNotification: method, which is called only when
your app is running, the system calls this method regardless of the state of your app.
The short answer, you can't, since APNS is one way. However, since an app can execute arbitrary code upon receipt of a notification, you can use this to say, send an http request to your own server when the notification is recieved.
There are any number of reason why push notifications might not get delivered to your user, or might not be delivered in a timely manner. Apple does not provide any mechanism for you to query the status of a push notification that you have sent.
If your app is currently running on the user's device and the user is accepting notifications for your app, you can implement the following method in your app delegate. It would be called whenever a push notification is received and in this method you could send a request back to your server to indicate the message was received. However this will only work while the user is running your app.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
In general though, it sounds like you'e relying on push notifications for something you shouldn't. From Apple's Local and Push Notification Programming Guide:
Important Because delivery is not guaranteed, you should not depend on
the remote-notifications facility for delivering critical data to an
application via the payload. And never include sensitive data in the
payload. You should use it only to notify the user that new data is
available.
There is no way to find out whether the notification was delivered to the device or no. APNS is a one way service. If there is no internet connection on the device then the APNS server will hold the last notification for some period of time which is no specified by Apple. If a new notification is sent to APNS for delivery then the old notification data is lost and replaced by the new data if its undelivered. If the notification is delivered then also the old notification data is deleted on the APNS server.
Please go through the following link : Apple Push Notification
Hope this helps you...........
If you are using JAVAPNS to send the APNS notification, you can use the below:
List<PushedNotification> notifications =
Push.combined("alert", badge, "default", "cert.p12", "certpassword", true, deviceToken);
for (PushedNotification notification : notifications) {
if (notification.isSuccessful()) {
//Push is successful. Do your thing...
}
else {
//Push is not successful. Do your thing...
}
}

How to start an iOS push notification from an in-app process

I'm building an app that plugs into a third-party service that will send messages to the iOS device. So far I've been unable to find any documentation on then starting off a push notification when the delegate method is fired to say that a new message has been received.
So far, I've got the app registering to receive push notifications and the delegate method firing, I'm just not sure how to connect the two together?
The app will have a minimum deployment of iOS 5.1 if that helps.
This is not how remote notifications work. Their main purpose is to notify application about some event. So application only receives remote notifications and note send them. So scenario is:
App is notified via
application:didReceiveRemoteNotification: //if running
or
application:didFinishLaunchingWithOptions: //if closed
According to notification payload you determine what exact action you need to perform. For example notification says that a new message was sent to the user. Then you need to send your custom request to the your server and get that new message.
I've discovered that in this case it is not push notifications that I want but local notifications instead.

Resources