Polling for mail uses up battery life and can't be done too often. I have written a Qt program to run on my always on server and use the IMAP IDLE command to notice mail nearly instantly and send me a SMS message when mail shows up in my account. That allows me to see the text message in a timely fashion and then go read mail and manually sync to actually fetch the message (very handy for the mail account I have setup for things like traffic alerts). I can then save battery life by turning off sync on开发者_运维知识库 my mail account.
The next obvious step is to get a mail client that looks for the specially formatted text messages and pulls the mail down itself. Any mail client developers out there who'd like to add a poll via sms option to their client? (Just curious).
What you're looking for is the Android C2DM (Cloud to Devices Messaging). It's the in-house push-notification framework that Android uses for gmail (and almost everything else Google-related).
It differs from SMS in that the C2DM message does not have the burden of guaranteed delivery and its payload is much smaller than an SMS message -- so very little content can be delivered on it, only a reference to the content can be delivered through it.
It's been rolled out to third party developers through a limited Beta (if a developer attended Google I/O, they'll have priority to get into that Beta program), but Google has been delaying the official launch of C2DM to everyone else in the developer community repeatedly for quite a while now.
精彩评论