Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm beginning the design stages of a mobile application. I'm looking for knowledge about common practices for user notifications. I understand that the SDK for the device will expose methods which will allow me to notify a user how and when I need it to. What I'm not sure about is how my application gets notified from a external data source. Is it common practice to poll a web service for data periodically? Or is it more likely that my application will have the facility to receive data at any time?

For example: I have a website which asks users to fill out a contact form. I would like my mobile app to display a notification when one of these forms gets filled out. Should my app be polling my data server for updated records or should my site be notifying my app somehow of a new record?

Any opinions or advice are welcomed. Thanks.

share|improve this question
add comment

3 Answers

This will most likely depend on whether your target platform/device support server push. Not all of them do.

Also it is worth keeping in mind that even in some cases when it's supported, end user may have an option to turn it off.

  • Given above, I'd consider "push-only" application only when I am certain that it is established as a major feature at target platform. I mean if say, I know that 9 of 10 applications will fail without push I wouldn't mind designing mine so that it would also fail in such a case.
     
    For a less "push-friendly" target though I'd rather think about giving my application an opportunity to fall back to polling in cases when push is't available for some reason.
share|improve this answer
    
Although it will eventually be developed on several different platforms, Android will be the first. Would you consider that platform "push-friendly"? –  Josh Johnson Oct 9 '11 at 14:35
    
@user38214 hard to say. I did quick web search for "android server push"; overall impression is that it's not yet there. Though I could have missed something - better do your own study if you need to be sure. –  gnat Oct 10 '11 at 6:03
add comment

Almost always you would have the mobile poll the server for new data.

The 'new data?' request can be a very small message and so reduces the power/data cost on the mobile device, it handles the mobile being of/off/blocked/busy better and it scales to a large number of devices better than having to maintain an open connection to each device to push new data.

share|improve this answer
    
With polling, what is a reasonable time interval for udpates? –  Josh Johnson Oct 9 '11 at 14:36
    
Depends on the application. How often does the data change and how often does the user need to know ? –  Martin Beckett Oct 9 '11 at 14:49
    
The data can change at any time (anytime a form is submitted on the site). The goal would be that the mobile user gets notified as soon as possible. –  Josh Johnson Oct 10 '11 at 13:06
    
@Josh that depends on how soon is necessary. Email can arrive at any time, but you don't need informing within a millisecond but you don't want to detect the next frame of a youtube video every 15mins! –  Martin Beckett Oct 10 '11 at 23:31
add comment

Normally network elements in a mobile data network do not allow establishing IP connections from the public internet. That anyhow would be rather difficult since a server on the internet does not know the mobile devices dynamic IP address.

It is possible to configure exceptions, i.e. equip mobile devices with fixed, non-NAT-ed IP addresses, in GSM network usually via a separate APN on the GGSN. An example would be machine-to-machine applications.

Talk to your mobile network operator. He usually will be interested only if there is a business case for him.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.