I am creating an app in Swift 4 and I want it to send a push notification when the wind is above a specific value. I already have the app created and when you open the app you can see the current wind (scraped from a website).
Is it possible to send a message when my phone is turned off and the app isn't running? and how to do that?
You need a server to send push notifications when your phone is turned off.
I am working on Push Notification App. In that, I want to send Push Notification in Non English language like Gujrathi Lang.(Indian Regional Lang.) But when I receive notification in Gujrathi Language it was showing "??????" in Payload Push Message. But when I send Notification in English everything works fine messages are shown properly. I can't understand why it is happen As I'm first time working on Push notification.
Is there any Problem from my Server Side or I have to handle the Localized string from my app? At which end the problem is arise?
Need Valuable suggestions
Thanks In Advance
The problem is found and it was from my server side changed in notification Payload
When push notification comes, it the user click the app icon instead of clicking the notification to open this app.
Then how can I get the notification payload?
As others have mentioned, you can't.
You can only get the payload when launching from Notification Center because it means the user is interested in that specific notification. If you choose to ignore the notification and open the app by pushing the icon, you won't be able to get the push payload.
They have seemingly designed the architecture in such a way as to prevent the processing of piled up push payloads (say that 10 times).
This is proven because they really only allow you to process a push payload (when the app is closed or in the background) by going through individual notifications. If this wasn't the case, they would have to allow push payload processing code to run for all apps even when they were closed or in the background state.
I have already asked related question:
any option to know if apple app get the push notification?
And I got an answer that it is not possible to know if push notification comes to the iPhone when application is in the background and the user does not have it opened...
But I found something interesting:
I take 2 iPhones with WhatsApp. I open, in the first iPhone, WhatsApp and exit it (the WhatsApp is in the background now), then with the second iPhone, I send WhatsApp massage to the first iPhone.
When the push notification of WhatsApp reaches first iPhone I can see two "V" (symbols) near to the message (and I don't open the Push notification). After this I close the Internet & 3G in the first iPhone and again send WhatsApp message with the second iPhone to the first one. - and I can see only one "V" near to the massage (not read - not get push notification).
Now after re-enabling the Internet on the first iPhone and after I get the push notification I can see two "V" (again - I don't open the push notification).
How does it work? How does WhatsApp know whether the iPhone gets the push notification or not while the WhatsApp works in the background?
Let us call the iPhone with WhatsApp application closed - the receiver and the other iPhone you send messages with - the sender, and let us use generic term application instead of WhatsApp
The application at the sender is not able to learn that push notification has reached the receiver. It is by the nature of push notifications.
However, the sender is possible to send another - not a push notification, but prioprietary protocol - message to the application at the receiver which it (the receiver) is welcome to acknowledge to the sender in any application-specific way it wants.
So, I would guess (I don't know - I'm not affiliated with WhatsApp in anyway) that the double-v icon you get is when application message reaches the application at the receiver - and has nothing to do with push notification.
What you mean is just the basics of push-technology :
The whatsapp software runs in the background listening on a specific port
for incoming messages. It does this continuously.
BTW :
One V = message delivered from your mobile to the whatsapp server
Two V's = message pushed from whatsapp server to recipient mobile
Blue V's indicate message has been read
Whatsapp doesn't show if the person reads the message or not. It just informs when the message has been sent to the whatsapp servers(one V) and when it has been sent the person phone (2 V's). The double does not mean the message was read it just means that whatsapp connected to the phone and was able to pass on the message.
After receiving a push notification the receiver can download data from a URL that you include in the payload of your push notification. By requesting that URL the server knows that the receiver received the push notification and can pass this status on to your sender application.
Like so:
Add a specific URL in your push notification payload
Implement the application:didReceiveRemoteNotification:fetchCompletionHandler: method in your app delegate and in that method call the URL from the payload.
Implement a logic on your server that recognizes the URL call as a received notification
Let your sender application continuously get the current notification status from the server.
The above posters are all correct. Just to add one more thing. If Whatsapp has recently been closed, it is still running in the background and can still receive the message (hence the return receipt). However, after the app is left unused for a while (or other apps have higher priority) Whatsapp is terminated, then it will no longer receive incoming messages and will not return receipt.
Of course the observant person would notice a small lag between opening the app and the new messages being displayed which seems to suggest the messages are not downloaded in the background but only downloaded upon opening the app. So why does it return receipt while running in the background?
Im developing an iphone app with push notification service, the problem that when i sent an non English language notification the notification dose not appear on iphone screen but the Badge Number appear on the app icon and the sound for push notification played, on the other hand when i sent an English notification every thing going good.
i sent the notification via php service and the php can understand the non English language so where are the problem ?!!!
any help :)
I can confirm that non-English characters can be sent via APNS. I would focus on the php framework you are using.
Maybe this SO post can help: Push Notification in non english languages. Essentially, the payload length could be calculated incorrectly.