Reputation: 28248
I want to notify my app that there is new data available but I do not want my app to constantly polling my server = checking for it new user data wasting user data and killing the users battery.
Instead it would be nice to send a message to my app letting it know there is new data ready to consume.
Upvotes: 1
Views: 157
Reputation: 55554
Just don't register for alerts then the user won't get the alerts when the app isn't open but if the app is open you can still respond to notifications silently or how you choose.
Or: (this will save yours and users bandwidth)
When the app closes send a message to your server telling it that the app is closed and not to send new notifications. Then when the app starts send a message to the server telling it to send notifications.
EDIT: unless you want to have the app open automatically or download the new content in the background, in which case that isn't possible.
Upvotes: 1
Reputation: 4932
You can open socket to your server an d make it listen for data - this option will drain user battery, maybe not so fast as frequent HTTP requests. Also you can try do those HTTP request, but make them as long-poll. For example application will request some URL and server will hold that connection for specific amount of time or response something is there is data available for the user. When connection closed, your application should reopen it.
Upvotes: 0
Reputation: 18488
Isn't this the default behavior?, your application will be notified with a callback by the Push Notification server whenever there is new data.
Upvotes: 0