开发者

Push vs. pull notification on iphone

开发者 https://www.devze.com 2023-01-13 16:27 出处:网络
How are push notification better than pull n开发者_运维知识库otification on iPhones? Are there any links with more information about this?

How are push notification better than pull n开发者_运维知识库otification on iPhones?

Are there any links with more information about this?

Any help would be appreciated.


Pull notification requires the user to be running your app, and your app to be wasting battery power constantly polling some server (or waiting on some network socket in another thread , or using the new background services).

Push notifications, when enabled by the user, and if the phone has a network connection, allows a message to be sent to a phone even when it's not running your app, prompting the user that your app wants some attention. It uses a much lower power network connection than any frequent polling method.


If you want to know about push notifications, I'm guessing you are interested in the Apple Push Notification Service.

You can read about its architecture here:

http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html

There is no such thing as a "pull" notification, but using APNs gives you the advantage that you don't have to manually poll a server every so often within an app, which usually saves you a lot of battery life in the long run if you are interested in telling the user about sporadic, infrequent events. Using push notifications also allows you to interrupt the user if they are not currently running your app, which of course can be very useful in certain use cases.

You should think about what kind of message flow you expect to see between your app and any server components in your system. Push notifications make the most sense where some event external to your app is going on which requires the app to be updated in some way, and where the frequency of those updates is low or highly variable.

0

精彩评论

暂无评论...
验证码 换一张
取 消