Android :: Implementing A Timer Thats Active All The Time - Even During Screen Timeout
Oct 31, 2010
I've implemented a Service in my android app that starts a timer (using the standard java.util.Timer and java.util.TimerTask mechanism) to do some processing in the background on a pre-defined interval.
CODE:...
The service is started / stopped by my application like this.
CODE:..........................
As long as the phone is active (no screen-timeout occured), the service is running fine, and the Timer is performing its job at the defined interval. Even when I quit the application (using the back button), the timer remains active.
However, as soon as the phone goes into timeout, the timer task is no longer running stable. If I leave the phone in timeout for several hours (at night), I would see that on random occasions (sometimes a several hours interval) the timer kicked in.
Also, when the phone is activated again, all timer runs that have been queued are suddenly executed in one shot before resuming back to the normal interval.
What would be the right way of implementing a timer that continues to run properly, even after the phone has gone into timeout. Should I resort to using the PowerManager and WAKE_LOCKS (as described here http://code.google.com/android/reference/android/os/PowerManager.html), or is there another mechanism ?
View 1 Replies
May 4, 2010
is there a way to set screen timeouts to specific apps? For instance, when running navigation, can the screen time out be set to never timeout just for that app? I only want the screen to stay lite for certain apps.
View 10 Replies
View Related
Aug 9, 2010
I need a regular method in my app. The problem is: the following timer in the code do its action just one time. And the timer do it only(the one time) if i do an action( touch the display) after the time(2000) is over. U know what i mean? Maybe it have sth to do with the "OnTouchListener"?
CODE:..............................
View 2 Replies
View Related
Apr 24, 2009
I'm trying to put a timer in my code to determine the amount of time it takes to execute a block of code.
I've tried googling up some ideas, but they are all related to scheduling tasks, which is not what I want.
I want to, perhaps, place a time stamp in different parts of my code. How can I do this?
View 3 Replies
View Related
Jan 7, 2012
Is there any way to define countdown timer without specifying millisInFuture. i.e to have a countdown timer which stops only when explicitly stop() function called.
View 1 Replies
View Related
Dec 14, 2009
As in android, after inactvity of screen off timeout, android screen goes off. So here android itself uses some activity observer, to know whether user is currently active or not. I need not every keystroke or touch event with details, just knowing that user is active and getting a broadcastreceiver after some timeout value. Does anybody know something related to activity observing ? I got the code from in frameworks where it broadcast, but I am still figuring out code in android that monitors user activity.I am open to modify code frameworks too. || Hare Krishna Hare Krishna Krishna Krishna Hare Hare || || Hare Rama Hare Rama Rama Rama Hare Hare ||
View 2 Replies
View Related
Oct 1, 2013
Any tip on a Ir remote app that can send signals at a specific time or by timer?
I can controll my light with infrared and it would be awesome to automatically turn the lights on at a slow pace in the morning!
My phone is a LG G2
View 1 Replies
View Related
Sep 18, 2010
I have the screen timeout set to 1 min which works fine until I use the phone. When using the phone the screen times out (and locks) in about 5 seconds. This is a real pain when using voicemail etc and you need to interact with the keypad.
View 2 Replies
View Related
Jan 26, 2010
I posted this in the Support and Troubleshooting forum but didn't get any replies, so I thought I'd post it in the main forum.Hopefully some of you guys/gals/aliens (illegal or not, I don't mind) can help me out with this one.
View 5 Replies
View Related
Dec 13, 2009
I was messaging around today and found where to shut of the screen while charging, but I wanted to turn it back on and can't find where it is? Also before the update I could have sworn there was an option on the screen timeout to set it to never. Now I don't have that option.
View 2 Replies
View Related
Dec 30, 2009
I saw a while ago on here an App to toggle screen timeout but whilst screen was on it would dim if not using which I like the idea of. I cannot remember what it was called can anybody help? At the moment I am using 'Toggle Screen Timout' which is great but does not dim.
View 2 Replies
View Related
Aug 21, 2010
I would like to keep the screen timeout set to the default 30 seconds to save battery while the phone is not charging. However, I'd like to increase that to at least several minutes while the phone is charging. I don't want the screen to be always on it just doesn't seem like the best thing for the life of the phone. Could be wrong, it just feels that way.Is there any setting or app that would allow this?
View 1 Replies
View Related
Apr 9, 2009
I can see on OMAP zoom2 platform, the moment screen timeout happens my application is getting terminated. I have a Google map based LBS application which is running on Zoom. I have implemented the interfaces given in gps.h to libhardware_legacy/gps.cpp .
GPS application talks to android framework and Framework talks to libhardware to get the GPS info. Now I can see that the moment screen timeout happens and the display goes off, my application killed. Actually from the framework the stop interface (hgps_stop() ) gets called on screen timeout.
I am wondring why this is happening, as I am not sending any stop request form my GPS application to the libhardware.
Is it something related to Android power manager, that android Power manager does not know about my application is running?
View 2 Replies
View Related
Oct 21, 2010
I was using Google Navigation this morning to direct me to somewhere and the screen kept timing out and locking. This was happening every 10 minutes or so.
Surley this is not meant to happen on a NAVIGATION application where you would expect the screen to stay active all the time! how can i prevent this from happening?
View 2 Replies
View Related
Jun 13, 2009
I have an Android (1.5) application which needs to be constantly running when a button is pressed. So, when a button is pressed I would like the phone to remain on and not want the screen or CPU to time-out.
When another button is pressed I would like the phone to be back to normal and time-out as per user settings.
View 1 Replies
View Related
Nov 16, 2010
Is there a way to disable the screensaver while my app is running?
the dimming of the screen is what i mean.
View 2 Replies
View Related
Feb 22, 2010
I have a Nexus One and while using Google Listen to listen to podcasts my screen lock will go into effect. Unfortunately, when this happens, the podcast audio pauses. I can set the screen timeout to a maximum of 30 minutes but some of the podcasts are longer than that.
Is there anyway to have Listen suspend the screen timeout while it is running?
View 1 Replies
View Related
Jun 4, 2010
Tried a search, couldn't find anything.Can we turn it off? I checked the phone settings but couldn't find anything.
View 1 Replies
View Related
Apr 30, 2010
I finally had a chance to try the Google Maps turn by turn navigation, and i love it, but i got one problem.
To save on battery, i keep my phone display timeout to 2 minutes. The problem im running into is when the screen times out, it kills the navi and i gotta restart it....very annoying and sucks if a turn is coming up
Does anyone know a way to keep the screen from timing out while either plugged in, or in the Maps app?
View 5 Replies
View Related
Oct 3, 2010
I have had my Wildfire for a few months and am very happy.
Have an issue, my screen does not timeout. I have checked the setting under Screen timeout and is set for 15 seconds but still does not timeout!
Are ther any applications which stop this function working?
View 5 Replies
View Related
Aug 2, 2010
Updated to stock 2.2 using the OTA update just now. Everything seems OK, with one exception - the screen timeout no longer works. Doesn't matter what I set it to, the screen just doesn't turn off.
I do have KeepScreen installed, so I shut off its service just in case it was interfering with something somehow. It makes no difference - the screen just doesn't time out.
View 1 Replies
View Related
Jul 14, 2009
I have a map activity for which I would like to have the screen turned on as long it's active (the app consists of one activity only). When the activity is paused or stopped I want to return to normal on/off mode. Keeping the screen on works fine while the app is running but when I exit the app the screen stays on as well. What am I missing?
View 3 Replies
View Related
Aug 5, 2010
I'm new to Android development, and I was wondering if there is a way to have an app take a screenshot of the currently active screen, do some processing on the screenshot (which would be internal to the app and temporary; I don't want it in the photo gallery), then communicate with a remote server over the Internet?
I am of course looking for more than a yes or no answer. An example of an api call or library I could use to do this would be a perfect answer.
The purpose would be to have a program screen scrape another program to recognize some text and use it for updating an online service.
View 1 Replies
View Related
Aug 19, 2010
I've always had my screen timeout set at 30 seconds and I haven't installed any app recently that I would think messes with this setting, but twice now in the last two days my screen timeout has gone to "never."
View 3 Replies
View Related
Sep 21, 2010
I did a search but found no solutions to my problem. My screen timeout changes on its own. I usually set it for 30 seconds or 1 minute. Occasionally I notice about 2-3 times a week that the screen never shuts off and when I check my settings it is set at never. Any idea why its doing this?
View 2 Replies
View Related
Sep 23, 2010
My upgrade to 2.2 went very smooth. I do not have many of the issues people are talking about. I have one minor issue. I have my screen timeout set to 1 minute. About 3 to 4 times a day the setting changes all by itself to 15 seconds. Has anyone else had this problem? Or any suggestions on how to keep it set at one minute?
View 3 Replies
View Related
Aug 16, 2010
On my desire the screen does not timeout. I have set it to 15 seconds but the screen always stays on.
View 4 Replies
View Related
Oct 6, 2010
This is going to seem like a straightforward issue, however when listening to music/podcasts the sound will cut out when the screen times out. Is it supposed to do this as I would have thought the screen could timeout to preserve battery whilst music was playing?
View 5 Replies
View Related
Apr 16, 2010
I'm having a problem with my screen timeout - nomatter what I set it to, it soon afterwards resets back to 30 seconds. I've tried 2 minutes, 10 minutes etc. and it might work immediately, but not long afterwards it gets reset.
The only thing I had running that I thought might possibly affect it was timeriffic, but I've deactivated that now and its still happening.
And yes, I know that apps like screenmodewidget and Screebl can be used to work around the problem, but I'd rather fix it!
View 5 Replies
View Related
Feb 3, 2010
Just setting up the display profiles on my phone....does anyone know how to change the screen time out for different scenes.....eg when I'm using my phone normally I want the display to timeout and lock etc, but when the phone is on charge at work or in the car I never want it to timeout.
Changing the timeout setting seems to apply for all profiles.
View 2 Replies
View Related