Connected Socket While Suspended - Windows Mobile Development and Hacking General

Ok, here is my problem...
I am writing an IM app. I want to be able to get IMs while in suspend mode and at least play a sound or something. I have it all working, but it seems to drain the battery something awful.
I know that it is possible to do without draining the battery, because when I run AIM all night, i can get notices, but the battery use seems much more reasonable (though i haven't done scientific-type tests).
My question is this: does anyone know how suspend mode works with socket connections? I was wondering what, in my app, is causing the battery drain. Is it the windows message loop, the fact that i am doing a "ping" every 10 seconds, etc?
More importantly, how can i fix it... does the suspend ignore processes that have connected sockets, or does it only ignore threads with connected sockets? If the later is the case, the solution would be fairly simple: put all my socket code in a seperate thread.
I am running WM 2003 with the 6.24 radio stack from t-mobile. Any help would be greatly appreciated.

How are you executing code while suspended? Is the device actually suspending or are you keeping it awake all the time?
I am also interested exactly how things work while suspended and what can be done/monitored in the suspended state.
What happens to the GPRS connection when it suspends?
I do know that you can set notification timers that will wake up the device while suspended, but I'm interested to know if there other ways to do this.
-Blair.

Related

Battery Drain on XDA II

Hi,
I have a very recently purchased XDA II.
I was under the impression that the battery time was considerably improved.
Although I have turned down the backlight brightness when on battery power, it still starts to loose power when I receive or send a SMS for example.
Is this normal or do I have a duff battery ?
Steve
try turning off bluetooth when you dont use it
it's suppose to be a batt hog
Yup,
done that. I only have BT on when I am actually using my headset.
Any other idea's
Steve
when does it auto turn off ?
when does the backlight turn off ?
are there any SD cards connected seem to recall that they eat batt aswell
I've had mine a week, have the same power drain problem. After charging it all last night I managed to use it as a PDA for a total of 40 mins over a 6 hour period today before the battery drained. No phone calls were made, Bluetooth disconnected (I do have a 256 MB card installed, but I don't know if this has anything to do with it), furthermore the backlight is set to the default setting and the auto power off set to 1 min. In any case I would expect to get more than 40 mins use of the PDA, the specification states upto 15 hours.
I took the unit back to the store, they say that this is a rare problem (yeah right :roll: ), they gave me a new battery which I am now recharging, hopefully this will work.
mmmm, it's very strange.
I am doing a test now. I have a imate with the official imate upgrade. I have a gps sysonchip bt. One and half hours ago i connected the imate with the gps and i started a demo of 500 km. Now the battery is at 75%.....Maybe de last upgrade solved this problem.... :shock:
You should get far better performance than this.
Three things that can drain the power:
Communications/Peripherals - IR, bluetooth, SDIO wireless LAN etc. Disable all of them unless you're actually using them.
Processor hungry programs - check if you have anything running in the background that could prevent the device switching to full sleep mode.
Lack of radio signal - if you're out of contact with a base station, the device tries to connect at full power every 30s - a big battery drain, so if you know you're out of contact, turn off the radio.
However, even with everything running, I'd expect a running time way above 40mins, so it sounds like you have a hardware problem with your device. I easily get 3h full brightness, full processing (ie watching a movie or playing a game) with radio on.
Turn IR off?
Is there anyway to actually turn the IR off on the XDA II?
Just the Start-Settings-Connections-Beam-Receive all incoming beams checkbox.
tried the new battery today, same procedure as yesterday (no bluetooth etc), had a slightly better performance today from the new battery, managed to get roughly an hours actual use out of the PDA (games etc) over a period of... 10 hours, ooh atleast it lasted the working day so must be better... however still no way near the 15 hours PDA work time as stated on the box!
However something I have noticed is that every now and then (after switching off the unit and just leaving it on the desk) the screen comes to life displaying a running program, (just how do you turn off the media player? I now realise it isnt with the "X"). Anyway why does it "power" back up? I wonder if this has anything to do with my power problem, that perhaps it has switched back on whilst in my pocket (BTW I have set the buttons so that they do not switch the PDA on accidently)
So, I'm recharging again, (I think I might take the MMC card out see if tht makes a difference). I expect something better for my EUR 500, what is the point of being able to go online anywhere if you have to be plugged into the mains! If I can't get the damn thing to work satisfactoraily by next week then it is going back to the shop, despite it being a Gucci shiny piece of kit!
@MoistVelvet: Actually, it;s not so much the device itself but the operating systems that is the cause of a few quirks. Luckily, a lot has been written on this forum and other forums on websites such as www.ppcw.net. A lot can been improved by limiting the number of programs that can be found in the \windows\startup folder of the XDA II. I'd suggest you have a look around in the various topics. I ended up honing my XDA II to a point where I am actually very very satisfied with it's performance ...
Can someone repost the items in the windows start up folder than can be deleted and what they do on the XDA II.
I was surprised at the amount of apps in there, but dont know what I can safely delete.
Steve
Wiz,
thanks for the tip, I'll have a look around.
Well the batery did last longer yesterday, managed to get through a whole workig day before it ran out, so the jury is still out!
Realised perhaps one of the reasons why the unit would switch itself on, whilst at work I have a very low signal, so every minute or two the signal strength would go up and switch the screen on. I have set to auto switch off after 1 min, but I wonder if there is there a way to stop it from switching on?
Hm, my experience is quite different. I use it throughout the day with around 15 phone calls, at least 2 GPRS synchronisations, some other usage of contacts, calendar and email and when I get home it's still around 60 percent - the most drain appears to happen on the way back home when I use the BT headset...
When your uses so much more power you may like to check what kind of programs you use. First idea is to have a critical look at fancy today plugins... my worst experience was with Battery Pack, the best way to empty your battery :lol:
Maybe you like to use UpTime plugin (http://ae.inc.ru/uptime_t.html) which really tells you how much you actually use the PocketPC and which doesn't do anythings while it's switched off...
MoistVelvet said:
Wiz,
Realised perhaps one of the reasons why the unit would switch itself on, whilst at work I have a very low signal, so every minute or two the signal strength would go up and switch the screen on.
Click to expand...
Click to collapse
Actually, the reason it periodically switches on is the O2 Homezone application. Whenever your phone changes to a new base station (which can happen even if you don't move), the stupid Homezone app turns the phone on. This is a known issue, and the only known remedy is to disable the app completely (remove from Autostart folder, soft reset phone).
Cheers
Daniel
Hi
I have an xdaII, which i load loads and loads of things onto. I did find that the battery was draining quite quickly. eg. charge it all night, just leaving it running in the day with hardly any use would drain the battery by about 90 percent! Bluetooth was off etc.
One time, the thing drained completely, and it needed a hardboot. Im going to send it back shortly for investigation/repairs.
However, since it hardbooted, i have not installed a thing. And i am finding that the battery is lasting a lot longer. I managed to go 3 days, of average usage, (few incoming/outgoing calls), without charging the battery!
This makes me think some apps must cause the battery to drain. I had battery app installed (that runs in today screen). I had fonix voicedial installed. I had quite a few games installed.
I think some software was causing the battery consumption,.. possibly battery pack.
re
I have previously had problems with battery drain, due to apps running in the background.
I also found specific apps like the battery pack, LAN sdio, bluetooth and the camera app, would drain the battery quickly.
Although you can manage closing apps down through settings/system/memory/running programmes I found the app Gigatask http://gigatask.com/ a simpler way to manage tasks.
There are others, but I found this suitable for my needs.
Now when I close an app I know it's closed and not running in the background draining the battery.
I still charge daily, habit now when I get home from work, but I have no worries about battery drain, and it rarely goes lower than 65% for a normal days use.
Cheers, Shire
turning infrared beam recieve off will help a little
:wink:

Auto Power Not Working

Hi There
Great device but for some reason after installing BT Tools and SPB GPRS Monitor the turn off after so many minutes fails to work.
The setting are correct and I've even used the same settings for both the BT Tools battery profiles but it doesn't work. The backlight goes off just like it should but the unit never powers down. As a result I'm unwittingly chewing through battery power unless I manually press the power button.
Has anyone ever experienced this? If so do you know why? Many thanks in advance.
Update: I have since removed BT Tools and the auto-power off is functioning properly again. Any and all advice will be appreciated.
mmm maybe this is the same problem i am having?
I get messages SMS at 6am every morning (scheduled from work) most mornings when I pick my phone up, it is off and the message is there, some mornings even though when I went to bed the battery was full the phone is dead (backup battery and all) I presume the phone is waking up when the SMS comes in and not shutting down so the battery runs completely dead. Although the blue light on the top of the phone is falshing....
I also run BT Tools and will try uninstalling it and waiting a week or two to see if the problem goes away. It doesn't happen every day by the way it seems to happen maybe every 10 days or so......
OHHH BTW I don't have GPRS Monitor installed, just BT Tools!
You dont put it on charge overnight?
I do, but I find that if I leave it on the entire day I only get 3.5 hours of use out of it and then it needs to re-charge. So it needs to turn off when idle.
cruisin-thru said:
You dont put it on charge overnight?
Click to expand...
Click to collapse
I do sometimes but not always especially if it is already 100% (or close to it), it is still an issue IMHO, having to leave the phone plugged in when fully charged isn't a perfect solution and generally I thought not the best for the battery in the long term!!!!
Besides the same thing could happen during the day, if you dont hear the SMS come in and the phone is in the case clipped to your belt and its switched on for an hour, when it need not be on at all!!!!
Don't get me wrong I love the functionality BT Tools provides, it is a fantastic program, I would just like to know how common this problem is? I will also try and contact the author and see if they know of this problem?
Hardest part is that it doesn't happen every time, only sometimes, just makes it harder for the author to track down the cause, from personal experience I hate tracking down these sorts of problems!!!

Blackberry kills my battery (XDAII)

Hi,
I have just got Blackberry set up on my XDAII (1.72 ROM) via O2 and all seems good with the world. Until the battery runs out while you watch.....
I have tried all the normal tricks to save power - switch the screen off quickly, dim the screen etc, but to not avail.
Is this normal? Is there a fault with my battery? How can I fix it?
Help!
Jon
p.s. Don't get me on the wisdom of a system that loses important data when the battery goes flat....
I have it on my XDA 2 also. Using TMo in the USA as service provider. No real issues with Battery as best I can tell... Can use it most of t he day for Blaclberry e-mail until battery dies...Maybe 50+ messages... mY xda 2 does seem to power right of after receiving blackberry mail, then power back on again when next message is receievd
Blackberry kills my battery (XDAII) - GPRS the culprit?
Hi,
the problem seems to be a GPRS one. The application (Blackberry or the Traffic-i traffic monitor) seems to keep retrying to connect and kill the battery that way. Anyone seen this before?
How long should the battery last anyway. I looks like it can make 24 hours tops with this settup.
Jon
Re: Blackberry kills my battery (XDAII) - GPRS the culprit?
jftilbury said:
Hi,
the problem seems to be a GPRS one. The application (Blackberry or the Traffic-i traffic monitor) seems to keep retrying to connect and kill the battery that way. Anyone seen this before?
How long should the battery last anyway. I looks like it can make 24 hours tops with this settup.
Jon
Click to expand...
Click to collapse
It sounds like your Blackberry connection is failing to connect? Can you confirm that you receive emails via bb ok? If your account isn't setup properly by your network provider then the bb software on the device will continually try to connect, and that will be a major battery drain.
Or maybe some other app is conflicting with bb? Not sure what you mean by "Traffic-i traffic monitor". You say the bb app keeps retrying to connect. But it should stay connected all the time if setup right.
JD
Battery problems (1.72 to blame?)
Blackberry works fine *most* of the time. It gets and sends email and is responsive and prompt.
Traffic-i is an application that connect via GPRS to a server to download traffic problems which are displayed on a map. I do not run it at the same time as BB.
The problem seems to be that the battery life is not linear. I seems to be going along fine then next time you look it is totally flat with the backup flat as well.
Just once I saw it get into a state when it couldn't connect to GPRS due to a poor signal. The screen kept flicking on all the time then off, then on. Because the XDA was busy it wouldn't switch the screen off leading to a flat bettery.
I am not sure if this is causing the battery problems but it seems like a prime contender. It seems to have happened since I installed 1.72 of the ROM - no problems before that. Has the behaviour of GPRS re-trys changed in 1.72 ?
All help greatefully accepted. I have to go now re-install my applications. Again.
Jon
Hi Jon
I use my XDA 2 pretty heavily on Blackberry and voice. My experience is that the attery really only lasts a little less than a day without a recharge, but I have not experienced the kind of problem you have. The fact that its killing the back up battery, seems to indicate something more that the Blackberry app as the problem. My device pretty much shuts off apps at 10% battery left, so that phone etc will not work until recharge. Saves losing info etc. You might want to try reinstalling the ROM 1.72.181 and see if that fixes it..
Hope that helps
Chris

Automatically turn phone/internet off when battery is low

Hi,
Does anyone know of any software that'll turn off the phone or internet connection when the battery power reaches a certain point i.e. 30% of max?
I would find this very useful as i often forget that it's on and wake up the next morning to find that my battery is all but flat
Cheers,
PhoneAlarm gives you an adjustable warning alert, so you don't just get the warning when it's too late to do owt about it if that's any use.
thanks, it's not quite what i had in mind though. I really want something that will turn the phone/gprs functionality off automatically at a predetermined level... is there anything else out there?
Predetermined, I don't know. You can hook into certain events in the registry, or use the system event scheduler (eg Memaid, SKTools). Then use software like VJVolubilis to disable wifi and gprs, and my other apps to close the phone.
V

How to improve battery life?

can someone tell me how to improve the battery life through the options since i am new...
disable vibration at touch flo
disable auto rotation
enable auto bright
In notifications, disable the sounds and the screen coming on for Reminders etc
Make sure you Close (not minimise) apps before putting your phone on standby
Don't use push web/ auto weather update auto rss etc
set phone to 'lock' phone when you switch it off (search other threads)
These should help stop your phone from doing 'stuff' when you put it in standby (or put it in your pocket) and using up battery when you just want it on standby.
and the best thing to do is, stay with stock rom :-D
cottonpickers said:
In notifications, disable the sounds and the screen coming on for Reminders etc
Make sure you Close (not minimise) apps before putting your phone on standby
Don't use push web/ auto weather update auto rss etc
set phone to 'lock' phone when you switch it off (search other threads)
These should help stop your phone from doing 'stuff' when you put it in standby (or put it in your pocket) and using up battery when you just want it on standby.
Click to expand...
Click to collapse
Using S2U2 helps with all this which is both pretty and useful as a locking app.
Tony
The best thing to do is switch off data connections, but the kind of defeats the object of a PDA.
Best to grin and bear it, as ROMs and Radio improve, I've found it gets better, still crap, but better than it is now.
On the Diamond if you went into phone settings and used GSM instead of auto it gave a nice boost to battery life. Something to do with constantly searching for HSDPA I think.
Lol Chippa, That didn't work to improve the battery... But it did give me 3 more bars of reception xD Lol, PROXIMUS LIED ) I contacted them on the matter of bad reception, And they said I should have excellent reception... apparently, their 3G network isn't that good yet x)
Then perhaps, the radio on the TD2 isn't as bad as I thought
Hi
The best thing to do is switch off data connections, but the kind of defeats the object of a PDA.
Click to expand...
Click to collapse
I think this is an urban myth now. A mobile data connection doesn't use any more power when idle. You maintain a data connection all the time with the mast, that is how your phone works to receive text messages and phone calls. A data connection on the phone is just the same thing with the added extra of your phone having a valid IP address on the network.
It will use less power to keep the IP address continually rather than have it connect and get a new one each time as obtaining an IP address uses power.
You can test yourself with any application that shows mA of the battery and it isn't any more for having a data connection on, unless of course you have an application actively using the connection.
Regards
Phil
PhilipL said:
Hi
I think this is an urban myth now. A mobile data connection doesn't use any more power when idle. You maintain a data connection all the time with the mast, that is how your phone works to receive text messages and phone calls. A data connection on the phone is just the same thing with the added extra of your phone having a valid IP address on the network.
It will use less power to keep the IP address continually rather than have it connect and get a new one each time as obtaining an IP address uses power.
You can test yourself with any application that shows mA of the battery and it isn't any more for having a data connection on, unless of course you have an application actively using the connection.
Regards
Phil
Click to expand...
Click to collapse
I think the problem is for those of us with poor 3G reception. Continually reconnecting to the 3G network increases consumption. I'm no expert so I cannot state this is categorically true.
Tony
in advanced config power management enable all.
I am disconnecting GPRS/3G when turning the device off and I do believe that I have a quite better batter life...
Hi
in advanced config power management enable all.
Click to expand...
Click to collapse
I'd advise against this. HTC are not stupid and they will be disabled for a reason. The drivers are either ignoring these settings or the power savings are very insignificant or it means more power is used.
Powering down these things also costs power to bring them back up, which means it can use more power sleeping and re-awaking devices than it does to just keep them on. This is why SmartPhones (non touch screen) don't sleep like Windows Mobile PDAs, they just turn the screen off but the CPU is still on responding and programs are still running and awake. Historically Windows Mobile PDAs were not mobile phones, they were just PDAs, so it made sense to make them sleep where the CPU shuts down completely and no programs run, basically like a computer hibernating. This still happens today but isn't ideal now as PDAs are constantly having to turn on to receive text messages or phone calls or retrieve email etc, and each time the phone has to leave standby it uses power to initiate all the drivers, so you end up expanding more power transferring between power states than you save. Microsoft will move to the 'always on' modal like SmartPhones probably with Windows Mobile 7.
Why the long explanation, well HTC may be deliberately not using power management as they are moving parts of their phones to be always on, and trying to enable these things may cause instability or for the phone to use more power.
Using a program to measure mAmp draw on the Topaz there was no difference in power consumption between having power management enabled or disabled, so my opinion, leave it as it is.
Regards
Phil
PhilipL said:
Hi
I'd advise against this. HTC are not stupid and they will be disabled for a reason. The drivers are either ignoring these settings or the power savings are very insignificant or it means more power is used.
Powering down these things also costs power to bring them back up, which means it can use more power sleeping and re-awaking devices than it does to just keep them on. This is why SmartPhones (non touch screen) don't sleep like Windows Mobile PDAs, they just turn the screen off but the CPU is still on responding and programs are still running and awake. Historically Windows Mobile PDAs were not mobile phones, they were just PDAs, so it made sense to make them sleep where the CPU shuts down completely and no programs run, basically like a computer hibernating. This still happens today but isn't ideal now as PDAs are constantly having to turn on to receive text messages or phone calls or retrieve email etc, and each time the phone has to leave standby it uses power to initiate all the drivers, so you end up expanding more power transferring between power states than you save. Microsoft will move to the 'always on' modal like SmartPhones probably with Windows Mobile 7.
Why the long explanation, well HTC may be deliberately not using power management as they are moving parts of their phones to be always on, and trying to enable these things may cause instability or for the phone to use more power.
Using a program to measure mAmp draw on the Topaz there was no difference in power consumption between having power management enabled or disabled, so my opinion, leave it as it is.
Regards
Phil
Click to expand...
Click to collapse
Hi Phil,
Theoretically you right, but i don't agree with everything.
There are other tweaks that definitely improving performance but still, HTC did not set it, so probably they have their reasons...
I used this tweak more than year on several devices & many roms and did not see any stability or other issues.
About powering on versus idle,
If it takes more power to turn on than keep idle (i'm not sure thats so but lets assume) then it must depend on how long its idle - there must be a time frame from where it do saves power.
The only question is if its actually doing what it supposed to do or not...
PhilipL said:
Hi
I think this is an urban myth now. A mobile data connection doesn't use any more power when idle. You maintain a data connection all the time with the mast, that is how your phone works to receive text messages and phone calls. A data connection on the phone is just the same thing with the added extra of your phone having a valid IP address on the network.
It will use less power to keep the IP address continually rather than have it connect and get a new one each time as obtaining an IP address uses power.
You can test yourself with any application that shows mA of the battery and it isn't any more for having a data connection on, unless of course you have an application actively using the connection.
Regards
Phil
Click to expand...
Click to collapse
Dude do a simple 1 day test with data on, then data off, then lets compare notes
Hi
About powering on versus idle,
If it takes more power to turn on than keep idle (i'm not sure thats so but lets assume) then it must depend on how long its idle - there must be a time frame from where it do saves power.
Click to expand...
Click to collapse
Info on the subject here http://blogs.msdn.com/windowsmobile/archive/2005/08/01/446240.aspx
Like I say I've tested the current draw and saw no difference enabling the power management options, so I think better to leave alone, at best the settings are ignored by the drivers, at worse they may have some negative effect I can't see.
Yes there are settings that may make the phone quicker like enabling caches or making them larger, sometimes we think things are quicker, sometimes they really are Just like a computer some performance settings are off for safety, for example write caches which when enabled could mean data loss, so HTC (and any other manufacturer) will be very reluctant to enable these things, again these things are disabled for a good reason, and not just because HTC want their phones to be slower. I never said all settings should be left alone, and if you want to risk losing data for a slightly faster PDA (whether real or a placebo effect) why not.
Dude do a simple 1 day test with data on, then data off, then lets compare notes
Click to expand...
Click to collapse
Having the phone maintain a data connection does not use more power in itself, I have done the tests and linked to an article below. If you enable a data connection to use Push/Pull email then the fact the device is constantly polling for and retrieving email will of course eat into battery life, but it isn't leaving the data connection established doing that, it's the applications using it.
http://blogs.msdn.com/windowsmobile/archive/2006/07/14/666203.aspx
I don't just make this stuff up you know, I've worked with Mobile Devices (Windows CE mainly) for some time
Regards
Phil
Hi all I've been using TESS 1.6 ROM and Radio 4.47.25.13 and did the fake Exchange server to prevent ActiveSync turning on and enabled all the power management features in Advanced Config (especially ASyncMAC power management) and I've managed to go
Standby: 98 Hours 23 minutes
Talktime: 5 minutes
Device Usage: 2 Hours 7 minutes
Mostly using Facebook application, Checking Email and Occasional webpage surf. This all from one full charge on the standard battery. I think that's pretty good! It's improved a lot with the newer radios. I've just upgraded to 4.47.25.21 hopefully this will be better!
PhilipL said:
Hi
Info on the subject here http://blogs.msdn.com/windowsmobile/archive/2005/08/01/446240.aspx
Like I say I've tested the current draw and saw no difference enabling the power management options, so I think better to leave alone, at best the settings are ignored by the drivers, at worse they may have some negative effect I can't see.
Yes there are settings that may make the phone quicker like enabling caches or making them larger, sometimes we think things are quicker, sometimes they really are Just like a computer some performance settings are off for safety, for example write caches which when enabled could mean data loss, so HTC (and any other manufacturer) will be very reluctant to enable these things, again these things are disabled for a good reason, and not just because HTC want their phones to be slower. I never said all settings should be left alone, and if you want to risk losing data for a slightly faster PDA (whether real or a placebo effect) why not.
Having the phone maintain a data connection does not use more power in itself, I have done the tests and linked to an article below. If you enable a data connection to use Push/Pull email then the fact the device is constantly polling for and retrieving email will of course eat into battery life, but it isn't leaving the data connection established doing that, it's the applications using it.
http://blogs.msdn.com/windowsmobile/archive/2006/07/14/666203.aspx
I don't just make this stuff up you know, I've worked with Mobile Devices (Windows CE mainly) for some time
Regards
Phil
Click to expand...
Click to collapse
I agree that enabling all power saving options is probably not a good thing. I have been trying a selection
◦SD Memory power management - disabled
◦NAND Memory power management - disabled
◦SIM Memory power management - enabled
◦AsyncMAC power management - enabled
◦IrSIR power management - enabled
◦PPTP power management - enabled
◦L2TP power management - enabled
seems ok so far
Hm.. just got my D2 some days ago...
only thing I really hate is, that battery drops fast as hell!
phone was fully charged yesterday 11 PM... now at 09:30 AM battery is at 40 %...
the phone just lay on the table and only checked for mails every 60 minutes... and one phone call in the morning...
someone made same experience?
I thought battery life of Diamond 1 is bad... but now...
ChiefmasterB said:
Hm.. just got my D2 some days ago...
only thing I really hate is, that battery drops fast as hell!
phone was fully charged yesterday 11 PM... now at 09:30 AM battery is at 40 %...
the phone just lay on the table and only checked for mails every 60 minutes... and one phone call in the morning...
someone made same experience?
I thought battery life of Diamond 1 is bad... but now...
Click to expand...
Click to collapse
The battery thing is certainly weird. My TD2 was terrible at first never lasting a day but now lasts 3+ days and I can only put it down to using SL2U and changing over from a very old SIM to a brand new SIM.
I'm sorry I can't help more other than say it is working well here.
Tony

Categories

Resources