Iphone cannot receive push notification - push

I used Javapns to push notification to iphone, when i run the test applicaiton fist time, iPhone can receive the notification, but when i tried agian, no notication will be recieveed, about 20-40 minutes after i receive the notification, i tried again, then i received it, doese any limitatoin on appler server that i can only send the notifiction after special interval?

JavaPNS was recently updated to 2.0, and fixed ALL reported issues up to the release date. I believe it fixes the issue you are reporting, as the problem being described seems to be caused by an un-closed or un-timed-out connection.

Related

iOS 13 and silent notifications

I am running into a really weird problem where I can't quite nail down the root cause. Our app used to function properly for background/silent notifications for ios12 and ios13 up until a few weeks ago. So a bit of background information:
We use SNS to send visual/audible and silent background notifications.
We are aware of the apns-push-type header that is required for ios13. SNS automatically handles this new header and our manual testing (i.e. without SNS) have also produced the same results.
The silent notifications (i.e. content-available: 1) always fail on ios13.3 (or higher) but always work on ios12.4 (and below).
In our swift code, we are using :didReceiveRemoteNotification:fetchCompletionHandler for silent notifications. We are also using userNotificationCenter (with willPresent and didReceive). Whenever we send audible/visual notifications, willPresent gets triggered on ios12 and ios13. On ios12, silent notifications trigger didReceiveRemoteNotification:fetchCompletionHandler but nothing with ios13.
During our testing, we successfully sent an empty alert type to trigger a silent notification on ios13 and this works on ios12 as well (this triggers willPresent). This feels like a hack to me because it will likely wakeup the device momentarily and the notification will disappear if the app is running in the background.
In other viewcontrollers, we are observing NotificationCenter for received messages to take appropriate actions.
To me it seems, {"content-available": 1} never works on ios13 and but does on ios12. Also didReceiveRemoteNotification:fetchCompletionHandler never gets called on ios13 but does on ios12. Our intent with silent notifications with (i.e. with content-available:1) is to refresh the details from our service when changes occur when the app is in foreground or background.
Any help would be appreciated.
I was able to resolve this issue. Before I get into the solution, however, I want to mention that I ran into this problem only on iOS13 and with silent notifications. The same code was working with iOS12 with same feature.
Our app has a separate screen for requesting notification permissions when the app is launched first time. At this stage we register the device for notifications. Next time when the app is launched, we don't show this screen anymore. To get it to work on ios13, we had to re-register with APNS in AppDelegate's didFinishLaunchingWithOptions every single time. Again, on iOS12 silent notifications were working without re-registering with APNS but on iOS13 we have to re-register every single time.
I hope this helps anyone else running into this problem.

Inconsistency in receiving push notification

I found some weird behavior in push notification. My iPod app receives push notifications till last week with no issues. Then I found that my app is not receiving push notifications, and I changed the certificates and it worked fine, and after 2 days its not working. And I repeated the same process and same kinda problem. I was wondering why this happens?
NOTE I am using my own java based server to send push notification. I am sure that my certification are not expired. At the time of this problem the badge id is also not visible with my application icon.??
Thanks in advance.
Ensure a few things
You are using the correct combination of production or dev pem and the APNS or sandbox server URL
Check the Feedback services to ensure whether you are getting any errors
I faced similar issues with my 3GS running OS 4.1 last week. It started working after I restarted my device. Try doing that and see if it works.
Please make sure to update the device token in the database of you provider. I guess some updates in your iOS/certificates may changed your device token. Just make a test around that.
Try lostInTransit's solution and also check for your internet connectivity. I also faced this issue with my iPod sometimes the push notifications not come in my iPod. Try this -
Install facebook iPhone app on your device.
Send a test push notification from your server.
If the notification does not come then do something with facebook which should generate the notification.
If the notification from facebook does not come it means its related to your net connectivity.And your code is perfect.
Sometimes I see that when my iPod is on DHCP it does not receive the notification but when I assign it a static network (dedicated IP) it works fine.

Issues with receiving push notifications -

I have a problem where I don't receive notifications every time I push them to the device. I do receive them occasionally or after a big delay. I'm using the development certificate for APNS and Ruby on Rails on the server side. The server does send notifications to the Apple server its only when I'm receiving them I have a problem.
I initially thought it was a problem with global notifications (tunnel being closed) and to test it I sent my device a notification to Skype which was received almost instantaneously. So, I really dont understand whats the problem here. Is there anything I'm missing or how do I trouble shoot it in depth.
Are push notifications reliable and whats the latency involved? Any help will be greatly appreciated. Thanks
In development, the sending of push notification is not reliable. Some notifications may arrive with some delay. You can try to send notifications in production by building your app in adhoc.
If you haven't the same result with different iphone/ipod, you can try to reset network settings device.

Apple Push Notification Service - notification messages aren't sent to iphone device

I constructed provider code with using C# and it was able to send notification messages to iphone devices successfully. But since yesterday, it hasn't worked. Also it seems to connect APNS successfully and send notification message. Unfortunately, no notification message is received by iphone device. I controlled internet connection and device token of iphone device. What else can I do? Thanks in advance...
I dont have enough rep to comment on the question so typing out answer - Please add more details and I will edit my answer.
Is this in a developer / testing environment and are you using an ad hoc profile to install the application on the iphone devices?
Did you check if the device token has changed and that you are using the new/ correct token in the C# code?
Do provide more details of your problem.
Crazywood, I don't have a solid answer for you but I can tell you I'm in the same boat as you.
There are times when all my notifications go through and times when none of them seem to.
One guess is that not all notifications are sent. According to the docs, in production remote notifications are not guaranteed to be received by the client. My guess is that this is also the case for the sandbox.
-------- EDIT ------
I went through the trouble shooting list (http://developer.apple.com/library/ios/#technotes/tn2010/tn2265.html) and came across this:
The device may have lost its persistent connection to the push service and can't reconnect. Try quitting the app and relaunching it to see if registration completes the next time. (On iOS 4 and later on devices that support multitasking, you will need to force quit the app from the recents list.) If the registration does not complete, iOS has been unable to re-establish the persistent connection. You can troubleshoot this as described in the previous two sections.
I restarted the app and it made no difference. Then I rebooted my phone. That seemed to do the trick.

Weird Apple Push Notification behaviour when the receiving iPhone is turned off

I'm seeing some very strange behaviour from the Apple Push Notification Servers when the recipient iPhone is off. Here is my scenario:
-Send push notification A to Apple. Within a few seconds a push notification popup gets displayed as expected on the iPhone.
-Send blank notification to Apple to cancel previous one (the previous notification is pointless after about 10 seconds, that's why I want to get rid of it). Nothing displayed on the iPhone.
-Turn OFF iPhone completely (not asleep, it is powered down).
-Send push notification B to Apple. Wait 10 seconds.
-Send blank notification to Apple to cancel previous one. Wait 10 seconds.
-Send push notification C to Apple. Wait 10 seconds.
-Send blank notification to Apple to cancel previous one. Wait 30 seconds.
-Turn ON iPhone.
-After about 60 seconds a push notification popup is displayed for notification B on the iPhone.
-Notification C never seems to arrive.
This is very strange! From reading the Apple docs I was expecting only the latest push notification to be sent. I was hoping my blank notification would be sent, I certainly wasn't expecting the oldest unsent push notification to be sent!
The Apple docs say:
Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNS attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.
Has anybody seen this behaviour? Am I just hitting some sort of timing window bug? What should happen?
Updates:
-If I turn the phone off and wait 5 to 15 minutes before sending any push notifications then this problem doesn't occur. In this case when I turn the phone on I don't see any notification popup, although I'm not sure if this is a result of Apple dropping the notification, or their 'queue' working correctly (i.e. holding the newest blank notification instead of the first one with the popup).
-I will investigate further by putting an APNsLogging.mobileconfig onto the iPhone to see what notifications it got.
-Turning wifi off doesn't seem to change the results.
-I have raised a bug report with Apple for this scenario.
You may want to check for this behavior across both the cellular and WiFi networks. There's a lot of strange behavior when the phone is on WiFi, especially if there are multiple NAT router involved, i.e. in a large corporation where there's a main router and per-floor WiFi routers, or in a home where you have multiple routers used to extend the range. But on cell it's been pretty solid.
Also, the 10-second cancellation delay may be cutting it too close. They don't guarantee timely delivery and I've gotten lags of as much as 3 minutes on the production server after queuing off a push request. You may want to plan for system congestion.
Either way, it sounds like it might be worthy of a bugreporter report.
For the record, I raised this as bug ID #7349660 with Apple on 29th Oct (https://bugreport.apple.com), then gave them the additional diagnostics they wanted on 30th Oct.
No response from Apple since then, so I am assuming this is probably just low on their priority list, which is fair enough as it is quite a small timing window where the problem can occur (which I didn't realize when I first opened this question).
In apple's document it is said that it can cache the push notification up to 30 days.so u may get push once you switch on your iphone (provided you are having interconnection)
How soon was C sent after B? It seems like it may be a bug where there's some kind of timeout server side, and they accidentally keep B if C was sent too soon after...
If you have a good test example (and this seems like a good test) I would file a Radar report on this.