5,596,925 Members 48,615 Now Online
XDA Developers Android and Mobile Development Forum

xImapPusher - based on ImapPusher-0.60

Tip us?
 
Fixup
Old
(Last edited by Fixup; 13th June 2010 at 07:11 AM.)
#1  
Senior Member - OP
Thanks Meter 2
Posts: 144
Join Date: Nov 2006
Default xImapPusher - based on ImapPusher-0.60

This program is based on the source code of Imap Pusher Service (17762) V0.60:

http://www.codeplex.com/ImapPusherService

Improvements:

1) No longer quit;
2) Auto recovery from socket errors;
3) Auto re-connect;
4) No mail sync after a re-connection, good for battery life.

Many service providers timeout the connection very shortly. For example, Verizon closes inactive sockets after 5 minutes. While xImapPusher can recovery from these 5-min timeouts, it is better not to raise a mail sync each and every 5 min.

5) Added a connection management service, XinConnManager.

If data connection is disconnected, this service will know immediately and reconnect and restart the push service. This service is truly event driven, so there is no periodical polling, idle all the time.

The multiple version can push multiple IMAP accounts, based on the 061 source code made by camro. Tested to work with Gmail and Fastmail.

Enjoy!

[For best battery life, set refresh interval to 28 and the multiple version is recommended even if you have only one account to sync.]
Attached Files
File Type: cab xImapPusher.cab - [Click for QR Code] (75.2 KB, 802 views)
File Type: cab xImapPusherMultiple.cab - [Click for QR Code] (113.0 KB, 1073 views)
 
camro
Old
(Last edited by camro; 21st January 2010 at 08:46 PM.)
#2  
Senior Member
Thanks Meter 12
Posts: 1,761
Join Date: Apr 2007
<deleted by user>
 
SOHKis
Old
(Last edited by SOHKis; 2nd December 2009 at 04:25 PM.)
#3  
SOHKis's Avatar
Senior Member
Thanks Meter 128
Posts: 548
Join Date: Apr 2008
Location: VA
DLing & testing now! thanks fixup

any chance of being able to add more than 1 account to the .xml..?
 
rsenden
Old
#4  
Member
Thanks Meter 1
Posts: 36
Join Date: Apr 2006
Location: Rotterdam
Default Battery drain & stability

Until recently I was using Windows Live to get push email. This was working quite well, but nonetheless I've switched to GMail & IMAP for various reasons. I'm currently using EmailScheduler for IMAP IDLE support, but it looses connection quite frequently (as in 1-2 times per day). I also noticed that it drains the battery much more than the Windows Live solution. I did some tests with ImapPusher quite some time ago, but it wasn't stable enough.

Would xImapPusher solve these problems?

I noticed xImapPusher comes with a XinConnManager DLL; do you have the sources available for that component as well (I would like to know what I install on my device ;).

Kind regards,
Ruud.
T-Mobile MDA Vario I -> T-Mobile MDA Vario III -> Samsung Omnia II -> Samsung Galaxy S II -> Samsung Galaxy S4 Mini
 
rsenden
Old
#5  
Member
Thanks Meter 1
Posts: 36
Join Date: Apr 2006
Location: Rotterdam
Default Possible improvement?

I've been having an idea that could possible improve performance and battery usage of IMAP IDLE solutions like these.

Basically, one would implement some kind of IMAP proxy. This proxy would consist of a socket listener (localhost only) and an IMAP IDLE client. Pocket Outlook is then configured to point to this proxy instead of the actual IMAP server.

The IMAP IDLE client would basically remain the same. However, whenever Pocket Outlook connects to the proxy and issues a LOGON command, IMAP IDLE service is suspended. All remaining Pocket Outlook commands are simply passed through over the same connection that was previously used for the IDLE command. Once a LOGOFF command comes in and Outlook closes the connection to the proxy, the IMAP IDLE client resumes IDLE operation (again, over the same connection). Of course, LOGON, LOGOFF and similar commands issues by Pocket Outlook will not be passed on to the actual IMAP server; the connection will be managed by the IMAP IDLE client.

This way, you prevent Pocket Outlook from setting up its own connection to, and authorizing with, the remote IMAP server for each incoming email. Instead it will re-use an existing authorized connection.

I'm not sure whether it makes that much of a difference, but it might be worth the effort.

Kind regards,
Ruud.
T-Mobile MDA Vario I -> T-Mobile MDA Vario III -> Samsung Omnia II -> Samsung Galaxy S II -> Samsung Galaxy S4 Mini
 
camro
Old
(Last edited by camro; 21st January 2010 at 08:46 PM.)
#6  
Senior Member
Thanks Meter 12
Posts: 1,761
Join Date: Apr 2007
<deleted by user>
 
Fixup
Old
#7  
Senior Member - OP
Thanks Meter 2
Posts: 144
Join Date: Nov 2006
I've done embedded programming for 15 years, so you can trust my code.

Many programs, such as PortSip and EmailScheduler, are not event-driven, they keep polling which sucks battery, runs the phone hot and not reliable. XinConnManager is a true event-driven service, has no such problems.

When I have time, I'll re-write the entire ImapPusher from VB to native C++. Anything simply sucks when touchs .Net and VB.

Actually my current push solution is direct http push, very reliable and no any impact to battery life. Here is how to do it:

1) Run Depeche, a http server for PPC. Modify the SimplTex ISAPI to tell Outlook to sync mail when it gets a http request.

2) Run Pocket DynDNS to update "mypocketIP.homeip.net". This program works, but it uses Sleep(60 seconds) to update DynDNS. You know, Sleep() does not work as soon as the phone goes into suspend mode. So I made "XinServerManager", a service similar to "XinConnManager", to keep the connection and meanwhile call PDD to update dyndns immediately after a new (re)connection. Then kill the PDD.

3) Run PPC emulator on a XP machine and run a slightly modified xImapPusher on top of it. When email arrives, it sends a http request to my phone and the phone then will do a sync to get the new mail.

This is by far my push solution. It does not need any open connection between the phone and the server. True and pure push. This solves the porblem of 5-min timeout with many 3G providers such as Verizon. Such 5-min timeout kills battery. Before, 4 hours of push running would drain 10% battery, now with my direct http push, 10% will run the phone for 24 hours, like it is no push running at all!
 
bsinclair
Old
#8  
Senior Member
Thanks Meter 3
Posts: 125
Join Date: Apr 2008
Battery will always be worst using IDLE, this is one thing Microsoft did right. If you wanna know a little bit more, see here:

http://gudensoft.com/?p=140

Instead of using this, I moved to active sync as now Google supports it.
 
Fixup
Old
(Last edited by Fixup; 2nd December 2009 at 09:57 PM.)
#9  
Senior Member - OP
Thanks Meter 2
Posts: 144
Join Date: Nov 2006
Quote:
Originally Posted by bsinclair View Post
Battery will always be worst using IDLE, this is one thing Microsoft did right. If you wanna know a little bit more, see here:

http://gudensoft.com/?p=140

Instead of using this, I moved to active sync as now Google supports it.
That article is totally wrong, see my comments at the bottom. Both require an open connection, just inactive, no difference here between these two.

IMAP idle is actually better on this regard: it'll detect the 5-min timeout and make a reconnection, no push lost.

With ActiveSync, it won't detect the timeout and any mail arrived after 5 min until the next beatheart will not be pushed in time.

That's why AS makes you feel a little better on battery life. The default heartbeat is 8 min. So you do get slightly better battery life, but you pay for that with push delay. You may set "MinHeartBeat" to 300 (5 min) so you won't suffer from delay, but then the battery life is no any better than IMAP idle.

The only reason MS does not add IMAP support to WM is because they want to sell Exchange servers and the ActiveSync Direct Push service. Both Apple and Google went to this stupid route.

To address this 5-min timeout issue, I set xImapPusher to re-send the heartbeat without raising a mail sync.

BTW, MS Live push is based on IMAP idle, not ActiveSync. You know, years ago MS bought Hotmail which was Linux based, seems still Linux. Live is far more reliable than AS. Like rsenden, I too was using Live because it does not have all kinds of troubles with Gmail's AS push. However, Verizon applied the stupid 5-min timeout sometime this year or so, so I had to figure out my direct http push.
 
SOHKis
Old
#10  
SOHKis's Avatar
Senior Member
Thanks Meter 128
Posts: 548
Join Date: Apr 2008
Location: VA
Quote:
Originally Posted by Fixup View Post
I've done embedded programming for 15 years, so you can trust my code.

Many programs, such as PortSip and EmailScheduler, are not event-driven, they keep polling which sucks battery, runs the phone hot and not reliable. XinConnManager is a true event-driven service, has no such problems.

When I have time, I'll re-write the entire ImapPusher from VB to native C++. Anything simply sucks when touchs .Net and VB.

Actually my current push solution is direct http push, very reliable and no any impact to battery life. Here is how to do it:

1) Run Depeche, a http server for PPC. Modify the SimplTex ISAPI to tell Outlook to sync mail when it gets a http request.

2) Run Pocket DynDNS to update "mypocketIP.homeip.net". This program works, but it uses Sleep(60 seconds) to update DynDNS. You know, Sleep() does not work as soon as the phone goes into suspend mode. So I made "XinServerManager", a service similar to "XinConnManager", to keep the connection and meanwhile call PDD to update dyndns immediately after a new (re)connection. Then kill the PDD.

3) Run PPC emulator on a XP machine and run a slightly modified xImapPusher on top of it. When email arrives, it sends a http request to my phone and the phone then will do a sync to get the new mail.

This is by far my push solution. It does not need any open connection between the phone and the server. True and pure push. This solves the porblem of 5-min timeout with many 3G providers such as Verizon. Such 5-min timeout kills battery. Before, 4 hours of push running would drain 10% battery, now with my direct http push, 10% will run the phone for 24 hours, like it is no push running at all!
this sounds like a nearly perfect solution, now if it could only be done w/2-3 accounts.

i'll have to give this method a try someday when i get some freetime on my hands. thanks man!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes