Bluetooth stops working after 12 hours - Android Software Development

As the title says, after 12 hours with a BluetoothServerSocket open bluetooth stops and we have to turn it of and back on again to get it working again.
We are developing an application that runs on 2.2 for a client, we're using 2.2 as this allows us to use a large variety of low cost devices.
One thing our app does is to keep a BluetoothServerSocket open waiting for a connection from our clients custom hardware.
This socket is on a worker thread and so in some situations needs to exit. Closing the connection and trapping the exception does not work on all devices (they crash) and so I added a time out of 5 seconds, check of a thread exit condition, if no exit then wait again.
Any ideas?
Ta.

Related

Teething troubles

Hello, I got my new device on the 3rd Jan so it's still relatively new and vanilla. I have had a look here through FAQs and searched the X1 forum to no avail. I hope these are not too difficult to answer, many thanks for any advice
1. Freezing:
When I make a call the touch screen no longer takes touch inputs, it does display the call time etc. I have to end the call with the soft button then the screen comes back to life
Also, when I run Windows Media Player and start playing a track the same behaviour occurs and I timed a 2 minute delay before I could use the screen to do anything.
I am not running anything in the background when this happens
All I have installed on top of the new phone (<1 week old) is a torchbutton tool and a battery monitor (although his happened way before the battery monitor was installed)
2. Auto disconnect from 3G etc:
When I set my phone to auto check email for me I didn't realise it would leave the 3G connection running. I can't find anywhere to set this and have it shut down the connection when done. I am not worried about cost (much) but I do want to preserve battery lif.
3. GPS way off:
everytime I try the Vodafone tracker or google maps it never pinpoints my location accurately. I don't want this directing me into a river or car crushers at a scrap yard...
Any ideas?
I don't know about the other two questions but as for number 1) I'd say it's a fault with your device as i haven't heard of the problem before and i have no such issue with my Xperia. Maybe someone can help you...
Question 2
It seems by default you have to disconnect in Comm Manager.
Actually it's great it does not disconnect after every action, it would be hell to check 3 or 4 email accounts and connect each time (I had it on my other smartphone...)
OK I can live with the disconnecting thing, I'll just have to keep an eye on it and the battery usage.
I found something interesting with the media player freezing issue though, if I use the button on the side to adjust volume the screen become available in the volume slider and then the problem goes away, rather random but again - livable if this fix works every time (which it doesn't) I have noticed it seems to be the same tracks that cause this - is it the file size?
Still stumped for the screen freeze during calls though - fix that and I will sing your praises for at least a week and a half
OK The device got replaced... then broke again - ran out of power then wouldn't take a charge
Came back from repair (they wouldn't replace after the 14 days grrr damn vodafone)
Now it has new software on it (spb mobile shell and some random games)
I setup the stuff I like such as the Soft Buttons set to Rotate screen and bring up the Today screen
Now when on the X panel or any of the panels and Opera the Today button refuses to work
It is fine in IE or File Explorer
I am so sick of this damn thing getting so close to being useable and then dropping out on me
Any ideas before I have to go back to the shop and they send it away AGAIN?

Problem with GPS and unattended mode

Hi
I'm developing a GPS application (http://www.marathon-mobile.net/Download/DownloadLatestVersion), its working fine on most phone but I'm having some problems with HTC HD2.
The problem is that the GPS doesn't seem work when the phone is locked.
I have set the following:
PowerPolicyNotify(CoreDll.PPN_UNATTENDEDMODE, true)
SetPowerRequirement("gpd0:", CedevicePowerStateState.D0, POWER_NAME | POWER_FORCE, null, 0);
I'm also calling SystemIdleTimerReset(); every 100 ms.
This seems to work for all other devices (I havent received any complaints about them), but no the HTC HD2. Have anyone else experienced problems with HD2, do I have to set any other Power Policies for this device?
//Johan
I think another app got the same problem as well. I run the wmTorrent on my HD2 and when the screen's locked the WiFi shows reconnection when I unlock it. It seems to be some sort of power saving feature that's cutting off everything when it's idle (including GPS). I take it you're requesting GPS data via Windows API.
Nice app by the way, saw it on the marketplace and was gonna place an order. I'll wait till it's fully supported on HD. Let us know pls.
I see.. Thats maybe why I can not get TrackMe to work..
Sounds to me like some kind of power saving design. After all the HD2 haven't exactly got the biggest battery in the world.
Sorry guys, that comment doesn't really help solve you problem I know.
But it would be interesting to know if this is a Microsoft / HTC design 'feature'...Maybe it's worth checking with Acer Neotouch / Omnia II user?
Or does this issue exist on any other WM6.5 handset?
I have installed OziExplorerCE GPS Mapping and Real Time Tracking Software, and it has an option to turn the display off whilst leaving the GPS functioning, pressing the <end> button will turn the display back on as per normal.
This is definitely different to pressing the <end> button to suspend the device as if I do this then Ozi also wakes up with a reconnecting to GPS message.
I have tried this with both TomTom and Oziexplorer running, and as long as I use Ozi's own display off option, both programs keep running and tracking movements.
So it seems that it is possible to do what you wish.
abucas said:
I have installed OziExplorerCE GPS Mapping and Real Time Tracking Software, and it has an option to turn the display off whilst leaving the GPS functioning, pressing the <end> button will turn the display back on as per normal.
This is definitely different to pressing the <end> button to suspend the device as if I do this then Ozi also wakes up with a reconnecting to GPS message.
I have tried this with both TomTom and Oziexplorer running, and as long as I use Ozi's own display off option, both programs keep running and tracking movements.
So it seems that it is possible to do what you wish.
Click to expand...
Click to collapse
Sounds like they use SetSystemPowerState(null, POWER_STATE_IDLE, POWER_FORCE); in combination with multiple calls to SystemIdleTimerReset(); This could be a solution. Unfortunately it keeps the entire device in on, so it'll consume more power than just keeping the GPS on. I've currently sent a version to a tester with this enabled, so we'll see if it works.
I'm still interested in a solution using unattended mode if its possible. It could be as easy as setting another power requirement, if so we just need to find it.
Thanks for all the replies .
Good to find that, I will need that for SciLor's GrooveMobile

Google Latitude + HTC HD2 = Not updating properly

Hi Guys,
This has sorta been covered in the Google Mobile forum but I have yet to see anyone that has tested the Google Latitude in their HTC HD2.
The thing is, Latitude works but with 2 serious practical flaws:
1. Phone must be on, no standby so only can do minimum backlight.
2. Latitude does not work when Mobile Google Maps is minimised, ie. if you lock the device and although the phone is on, Latitude won't update.
What the Latitude suppose to do:
1. Still update location even if Google Maps minimised (phone must be on)
2. Still update location even if Google Maps has exited, but you check the "Yes" option for background updating (phone must be on)
So in real terms, you can't even put the phone in your pocket as the screen is not locked and it could start dialling someone in your contact list, let alone change settings for other programs.
It would be nice if Latidude can do its 2 main features above properly with the phone turned off, ie. you can still receive a call when the phone is off, weather still updates when the phone is off.
Anyone with similar issues I would appreciate any comments you may have.
Hi, I have this problem, too.
Mine does update the position when GM are closed nad 'yes' is choosen. Every 20 minutes, as it is supposed to do. It also uses only fast BTS fix, not GPS.
GM use notification (low-level alarm) to wake the phone up after 20 minutes and update the position. You can you for example FDC task manager to check if the notification exists after closing GM. It has page with notifications. You should see something with 'google' there, with time set 20 minutes after the GM exit.
http://www.dotfred.net/TaskMgr.htm
I'm not sure how it works with GM only minimized. Will report later.
It seems to update the location once per 20 minutes also when minimized (and not asleep (in charger).
Works every 20 minutes with application minimized and device asleep.
Btw. my version is 3.3.1
Latitude updates work or not.
Maybe my experiences helps.
I've been using the HD2 for a few weeks now. During initial startup several questions are asked. One of them seems to be if you want to allow location updates to be send from your phone.
Out of the box I had some time and answered all these questions. Next few weeks my friends tell me my Latitude position was being updated. I never started Google Maps though. Not once.
After a few weeks I had to upgrade the ROM (SMS bug). This time I did not take the time to answer all the questions (next next skip skip). In my opinion I would be able to set these settings in several menu's later on. As from this point on Latitude behaves like reported on this thread. Only updates when Maps is active.
Sorry to wake this topic but it seems still unresolved and I have some input.
Given that you have accepted the terms and conditions, especially location updates to be sent from your phone, Google Maps should update your position every 20 minutes, regardless whether it is running or not.
Once we have program settings out of the way as a reason, I think the problem is not related to Google Maps at all, but is actually an internet connection issue. In other words, I think GM is correctly updating your position every 20 minutes, it just cannot send it over the Internet for other people (and yourself) to use it.
Why do I think so? Because I have exactly the same problem as you guys describe, but only while at home. As strange as it sounds, the moment I go to my office, my position is perfectly updated every 20 minutes (I can see it on my Google account), but when I leave the office, my location stops updating. Mind it I never change any settings when I enter my office so this cannot be related to any activity I did. The only way I can explain this is that when I leave the office, my phone fails to connect and transmit my position, while it succeeds while I'm in the office.
As a next step I am trying to troubleshoot internet connections. I think the phone is using wifi to transmit location information. If it was using the GSM network, it wouldn't behave differently when I am on different places (the mobile operator is always the same and the Internet settings are always the same).

Data Connection stays on

So, I find that when I use a browser or any other data connection software, the data connection stays on after exiting the browser or other data use software. This tends to run my battery down extra fast if I forget to go into the Comm Manager and turn off the data connection manually. Or I'm in a situation where I can't take the extra time.
Question 1: what are other people doing about this?
Question 2: Is there a something like the WiFi switch programs (I'm using AKToggleWiFi) which make turning the data connection on or off something that can be done with a button or shortcut on the today screen?
On Question 2, the main thing I don't like about the Comm Manager are the number of steps involved, and when I turn on the Comm Manager, it takes a few seconds for it to realize that the data connection is on, before I can turn it off.
Thanks in advance
--
FB
frankenbike said:
So, I find that when I use a browser or any other data connection software, the data connection stays on after exiting the browser or other data use software. This tends to run my battery down extra fast if I forget to go into the Comm Manager and turn off the data connection manually. Or I'm in a situation where I can't take the extra time.
Question 1: what are other people doing about this?
Question 2: Is there a something like the WiFi switch programs (I'm using AKToggleWiFi) which make turning the data connection on or off something that can be done with a button or shortcut on the today screen?
On Question 2, the main thing I don't like about the Comm Manager are the number of steps involved, and when I turn on the Comm Manager, it takes a few seconds for it to realize that the data connection is on, before I can turn it off.
Thanks in advance
--
FB
Click to expand...
Click to collapse
Try this:
To disconnect network when idle for 1 min
HKLM\Comm\CommMgr\Planner\Settings\
Delete the following key: "SuspendResume"
add "CacheTime" value of 60
This should disable the connection if its idle for 1 min
hope i helped!!!!
Thank you! That works!. I set it for 30 seconds (BTW, had to use DWord, not string). I didn't delete the old Key, just set it to zero. I may need it for times when I'm doing a chat or something that I can't have it log off during...experimentation to follow.
Why doesn't it come with an option to turn off the data connection instead of burning through the battery after a certain wait period?
frankenbike said:
Thank you! That works!. I set it for 30 seconds (BTW, had to use DWord, not string). I didn't delete the old Key, just set it to zero. I may need it for times when I'm doing a chat or something that I can't have it log off during...experimentation to follow.
Why doesn't it come with an option to turn off the data connection instead of burning through the battery after a certain wait period?
Click to expand...
Click to collapse
To be honest I gave up on trying to understand Microsoft's reasoning, there is a number of performance issues that could be resolved easily that they choose not to fix.. They are special like that .. I thought about trying just disabling registry instead of deleting it, Glad that worked for you.
The difference in power use is profound. I think data connection wasn't just happening when I used it, but would go on by itself and stay that way. This is the first time I've seen this much power left in the battery after a whole day. It's still reading 100%, even though I've used the phone a couple of times. In 5 months, that has never happened.
I wish my wife's LG Touch was as open to problem solving as my WinMo phone. I'm pretty sure her phone has a similar problem draining down the battery.
new imagio issues...
Hello,
I am very glad to be returning to a winmo phone, after having been forced to use blackberry for a while. I have used many windows phones in the past, so am sort of familiar with rom flashing and registry edits.
Just got an HTC imagio, and am using it with corporate exchange server, connected through VPN. I have a couple issues that I am hoping someone can help with. When my VPN is enabled, I go through the entire battery in less than 6 hours. When it is disabled, battery lasts for about 2 days. Any ideas about how to make the battery last longer w/ VPN enabled? Would the approach described about disconnecting network when idle help with this?
In any case, I would like to try. Would someone mind please directing me to a registry editor that works on imagio? thanks, and I'd very much appreciate any other ideas!
EDIT:
OMFG...this works PERFECTLY!!! MY BATTERY IS LASTING WAY WAY LONGER, AND I'M STAYING CONNECTED TO VPN!!!
sorry for yelling...I am just so freakin' happy. This forum is great!

Shut down

My dell inspiron 15r 5521 when it shuts down it'd screen goes off but the lights stay on for about three minutes when the screen has gone off the only way to completely get the lights to go off is to hold down the power button for like ten seconds I know it's not good for it but sometimes when I'm in a hurry I have to this computer is like three weeks old so what's wrong with it also how do I keep wifi on when closing the lid is there a registry hack for that? And what is fast boot
Sent from my SGH-T759 and if my gramor is wrong it's probably because I sent this while walking or rushing before a class starts
The default "shut down" behavior on Win8 is to reboot the computer and then hibernate right before the login screen. This enables the "fast boot" you mention where the computer can be "started" (actually resumed) in seconds. The best solution to this is just never shut down (seriously, there's literally only a couple reasons to ever do this, and I don't think you're adding or removing hardware every time you run between classes...). Use sleep (suspend to RAM; near-instant both to suspend and to resume, draws a tiny bit of battery power but you can leave the machine that way for a week, usually) or hibernate (suspend to disk, takes a while - though it shouldn't be anywhere near 3 minutes - but then shuts down completely and uses no power at all). As a bonus, these methods don't require killing all your programs and starting them again, so you can resume exactly where you left off (even, for example, resume an interrupted download in most cases).
Disabling Fast Boot (look up how to do it, I'm not going to bother holding your hand all the way to the search box of your browser) would let you power the machine down more quickly, but will make bootup somewhat slower (though Win8 still boots up quickly). Disabling Hibernate will also disable Fast Boot, but I don't recommend disabling Hibernate unless you're seriously short on disk space (it reserves a "hibernation file" that is the size of your system RAM). In any case, it's probably just fine to move your computer while it finishes "shutting down" anyhow, though; no need to wait until all the lights are off (don't bang it against anything while the drive is spinning, assuming it's not using an SSD, but that's never a good idea anyhow).
As for leaving WiFi on while the screen is closed, the most likely only way to do that is to modify the Windows power settings to select Lid Close Action: Do Nothing (it will still turn off the screen, which will save a bit of power). However, this just leaves the computer running and will drain the battery almost as fast as using it. A few Win8 machines have a special low-power mode called "Connected Standby", which is similar to what smartphones and tablets do when in sleep mode, using more power than a full suspend-to-RAM but turning off almost everything else except the radios. If your computer doesn't already do this while in sleep mode, though, you're probably not going to be able to enable it; I believe it requires hardware support.
WiFi turning off when you close the lid is normal. Closing the lid *under default settings* puts the laptop into sleep mode. Sleep mode disables WiFi unless your device supports connected standby, which yours doesn't to my knowledge.
Advanced power plan settings will let you set it so that closing the lid does nothing. I would recommend creating a new plan if you want to do that.
Pausing downloads is exactly why I prefer torrents when available, sadly few downloads are available as torrents
torrents pause when you get disconected?
torrents break up downloads into much much smaller segments (few kb to 1mb max) and download each segment independantly. Lets say a 5mb file gets broken up into 10 half mb files instead. The torrent client will download them individually, if the internet gets cut midway through file 4, when you reconnect to the internet it still has files 1, 2 and 3 so still has 30% of the progress already. It can just continue from file 4. So yeah, torrents can survive internet disconnection, sleep, hibernate and even a complete system reboot (literally, shut down the machine, start it up 5 or 6 days later and you will be almost exactly where you left off). At the most you might be 1mb behind but as torrented files are sometimes a gb or more that is pretty insignificant. And even on a dial up connection 1 mb is not going to take long to restore.
For smaller downloads like a single MP3 track or a word document its not worth it. But I personally have an internet connection running at 100-200 kilobits per second, so if I want to download a 1.5gb linux distro the ability to pause the download is a huge benefit.
Sadly, few downloads are available as torrents, they are also peer to peer so that relies on a peer being available (basically rather than downloading the file from a dedicated server I am downloading various parts from different people who also have a torrent client and the same file).
Too many people also associate torrents with piracy. It is true that you can pirate movies via a torrent yes, but that doesnt make torrents illegal in any way. It is common for very large files to be offered as a torrent purely because of the pause/resume functionality. Most major linux distributions offer a torrent as a major distribution method.
My preferred torrent client is bit-torrent, heard a few recommendations for μTorrent.
Back ontopic.
Done a little more research. Pretty sure now that your system will not have Connected Standby so you are stuck with wifi turning off when you enter sleep mode. Chances are if you had it then it would already be enabled.
Not really sure whats happening with the lights. In order on the laptops I have had access too (including my old inspiron) on shutdown the display would shutdown, then the fan would cut off and the lights would go out and that would all be within 2 or 3 seconds start to finish (usually the display > fan transition was longer than fan > lights). Never seen 3 minutes myself but I doubt the battery drain from it would be significant so I would perhaps ignore it as an odd quirk, perhaps keep an eye on it.
Yeah idk about lights staying on that long because I'm pretty technology savy and we have a 2011 inspiron that manily my syblings use and it dosebt have that problem but I guessing I'll just keep an eye on it but does anyone know of any hacks to keep Wi-Fi on.
Sent from my SGH-T759 and if my gramor is wrong it's probably because I sent this while walking or rushing before a class starts
The wifi on thing is hardware. The system almost completely shuts down in sleep mode. It keeps a little bit on to keep the RAM active and a few other minor tasks but for all intents and purposes its completely shut down. Only if your device supports Connected Standby can it enter sleep mode and keep wifi on. But at the moment only intel clovertrail chips support it. I think the haswell may be getting it too.
There wont be anything like a registry hack to keep wifi on. Wifi off in sleep mode is a trait of all major desktop systems. The only major operating systems which do leave it on are probably android and iOS and they are movile systems which never go into a true sleep mode. They just dim the display and prevent user applications from being run (unless they are given explicit permission to run when locked).
If you really want wifi on when your lid is shut. Go into the power plan settings, create a new plan. Go into its advanced settings and there is a section about what action should be executed for various things like pressing the power button, sleep button (if applicable), reset button (if applicable) and closing or opening the lid of a laptop etc. By default close lid will trigger sleep mode. You can hit the dropdown box and set it to do nothing. Even when set to do nothing, when you close the lid the display will turn off. But otherwise the laptop will remain fully powered on, infact if you hook up an external keyboard, mouse and monitor the system is still usable. The battery drain will be almost the same as leaving your system idle for ages, but as the laptop wont be in sleep mode the wifi will remain on. Its worth looking through that menu anyway, I personally rebind the power button to enter hibernate
maybe the “fast boot” i
feherneoh said:
I hate being the noob here, but fast boot does really restart system when shutting down?
I thought that it starts to shut down just like when not using it, but when only the kernel and drivers are still running, it hibernates those instead of a complete shutdown. This would make the black screen appearing after the 'Shutting down' message clear, as it is used when hibernating the system.
Sent from my Htc Hd2 using xda app-developers app
Click to expand...
Click to collapse
It shuts down, rebooys and immediately hibernates. Then when you go to hit the power button to turn the system on it appears to boot ridiculously quickly because it only has to wake from hibernation. This might indeed cause the lights to stay on a little longer
feherneoh said:
But then why do the system slow down if I don't do a full shutdown or reboot eg for 2 weeks?
Sent from my Htc Hd2 using xda app-developers app
Click to expand...
Click to collapse
Is this really happen after Windows 7? I didn't restart my laptop and only use sleep mode since upgrade to Windows 7. I only shutdown or restart when Windows Update (sometime I force to not restart), software install, hardware fix.
feherneoh said:
For me everything slows down after 1 week without full shutdown/reboot, just like on Win7. This is why I cannot believe that it really reboots when performing a hybrid-shutdown.
Click to expand...
Click to collapse
What did you mean hybrid-shutdown? And what you did when you full shutdown/reboot?
I'm not experiencing the same issue on windows 8 myself
Hybrid Boot (that's the correct name for hybrid shutdown / fast boot) does not fully shutdown computer. The process is divided into two parts: log off all users and hibernate remaining system/kernel part. So if you have misbehaving drivers/services, then computer can become unreliable after some time.
When you restart computer, even with fast boot enabled, system goes to full shutdown without hibernation part, so this can temporarily resolve problems like above.
quidrick said:
When you restart computer, even with fast boot enabled, system goes to full shutdown without hibernation part, so this can temporarily resolve problems like above.
Click to expand...
Click to collapse
Can we have a confirmation about it? Because I enable/disable fast boot all the time...
You r right if you don't want that problem disable the quick boot options in power management......
Press thanks if i helped
Sent from my Micromax A116 using xda premium
A quick google on the issue brings this up
Windows 8 changes this by shutting down as far as closing the user sessions. At that point, instead of continuing and ending system services, and shutting down
Session 0, Windows then hibernates. This is called Hybrid Shutdown. The steps are shown below.
Click Shut down.
Windows broadcasts messages to running applications, giving them a chance to save data
and settings. Applications can also request a little extra time to finish what
they’re doing.
Windows closes the user sessions for each logged-on user.
Hibernate the Windows session.
Essentially a Windows 8 shutdown consists of logging off all users and then hibernating.
http://blogs.msdn.com/b/olivnie/archive/2012/12/14/windows-8-fast-boot.aspx
A full reboot of windows 8 takes a lot more time than the hybrid shut down. When you reboot, the actual shut down procedure of windows 8 occurs, without cutting off power, ofc.
Therefore, hybrid shut down aka fast boot has nothing to do with restarts.

Categories

Resources