Android :: Using AlarmManager As Timing Service

Jan 19, 2010

I wanted to ask a question regarding the Alarm Manager. I have a requirements of setting long running timers in my application. The minimum duration for my timer is 1 hour...and the maximum may be for 4-5 days. This timer is supposed to run in the background, and when it fires/expires, i have to show something on the GUI. The timer can be re-scheduled once it fires based on user action.

What is the best approach for scheduling such long running timers ?

Should i make use of the Alarm Manager ? Or will it be an overkill ? As far as i know, alarms are retained even if the device goes to sleep and they wake up the device when the alarm goes off.

I am thinking of using a simple Java TimerTask as an alternative to setting an alarm: http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html.

But i am not sure what will happen to the timer task if the device went to sleep while the task was running.

Android :: Using AlarmManager as timing service


Android :: AlarmManager Starting Service - API Level

Nov 10, 2010

I've read comment that the AlarmManager in a earlier API version couldn't start services. Prior to which API Level was that?

I'am currently testing in the emulator with API Level 4 and it start a service just fine.

View 10 Replies View Related

Android :: No Network Connectivity In Service/AlarmManager Process

Mar 24, 2010

I have a Service/AlarmManager set to go off ever hour; as seen at: http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices...

The Alarm triggers a Socket connection to communicate with a Web Server. I'm logging the interaction to a file so I can see it later. When I leave the phone on my desk for a day, it seems that more often than not I get a "Network unreachable" error when trying to do any networking.

I believe it is related to how deeply the phone goes into sleep. Is there a special kind of lock I have to hold, or some command required to prep the wireless radio so that it can be ready to access the Internet?

View 21 Replies View Related

Android :: Way To Use AlarmManager In Droid To Launch A Daily Service?

May 30, 2010

I need to run a service each night at midnight. I would like to use the AlarmManager to do this. Can you give me some guidance of how to make it work correctly?

View 1 Replies View Related

Android :: Timing Out An AsyncTask?

Apr 9, 2010

I know how to use AsyncTask in a standard manner to manage operations that are in the background in relation to a UI thread.However,I want to run a task in the background which might run for a very long time under certain circumstances. In these cases, I would like to force the background task to fail if it runs for an excessive amount of time.I know that I can invoke the "get(long timeout, TimeUnit unit)" method of AsyncTask in my UI thread in order to terminate my background task if it runs too long. However, in that case, my UI will block while this "get()" command is waiting.There are probably other drawbacks to directly calling "get()" in this manner, not the least of which being an evil interaction with the "done()" method of AsyncTask's contained FutureTask object, which itself is calling "get()" at least this is what I see when I look at the source code for AsyncTask.

View 10 Replies View Related

Android :: Timing An ASyncTask

Sep 20, 2010

I'm running a network service within an ASyncTask. I want to be able to time the task, and after a certain period of time interrupt it.Is there a simple way to do this? Basically, when the doInBackground() methods starts, I want to say "If it hasn't completed in 30 seconds, do something else".

View 2 Replies View Related

Android : Get Timing Information About Key Events?

Oct 5, 2010

I'm doing my thesis work on resource management on android and I want to be able to measure the "responsiveness" of an application to figure out if the application get enough resources and is scheduled often enough.

So what I want is a way to insert timestamps on events, e.g. button clicks, when they are created and when they are consumed. This way I can get the "responsiveness" of the application. But I have a hard time of finding exactly where the events are created and also consumed.

In Handler.java there is the handleCallback(Message message) method which I can insert the end time stamp. I tried to add a long variable in the Message class and that worked well (had to rebuild the api though). So my problem is to find the place where the button click is generated and where the message that corresponds to that event is being created so I can add a time stamp.

I also welcome other suggestions on how to measure the "responsiveness" of an application or other way to measure how well an application performs.

View 2 Replies View Related

General :: Android Battery Graph Timing

Feb 29, 2012

Why the time above the adroid bat graph and the one below are different. At this moment is says on my device 1h 28 minutes on battery. Below the graph 50m 22s is shown. What is the difference between those timers ?

View 2 Replies View Related

Android :: Droid APIs That Allow App To Retrieve GSM Timing Advance?

Dec 4, 2009

Are there any Android APIs that allow the application to retrieve the GSM Timing Advance?

View 2 Replies View Related

Android :: Handler Class And The Timing Of When Its Message Queue Is Emptied

Sep 6, 2010

I was curious about the nature of the handleMessage() and sendMessage() behavior of the Handler class. I want to be able to send message to another thread in such a way that the destination thread can process the message queue when it wants to. It seems, however, that the message is processed by handleMessage() practically as soon as it's sent.

I'm trying to design a game loop thread that does something like this:

CODE:.....

However, I as soon as sendMessage() is called (from the parent/calling thread), the Handler.handleMessage() is processed (in the child/receiving thread), even if the child/receiving thread is blocking in a while loop.

I've seen this problem solved in other games by using a thread-safe list (ConcurrentLinkedQueue). The UI thread just posts events to this queue, and the game loop can remove the events as it seems fit. I just assumed the Handler class was designed for this purpose. It seems it's more intended for asynchronous callbacks to the parent thread.

View 1 Replies View Related

Android :: Way To Setup AlarmManager?

Jul 20, 2010

I am currently setting an alarm to fire off a background service every 2 minutes in order to check my server for certain updates. Now if I start the app and my screen is on and not locked the phone plays the sound I need it to play and opens the activity. Thats great. But the way I need it to happen is if the screen is off and the phone locked I still need it to check every two minutes and I need it to play that sound and open the activity that is needed. This does not happen for some reason. Could someone explain to me why the alarm doesn't function when my app is not "running" (by this i mean the app is marked as a running process but not actually visible to the user) and the screen is off? The code for the timer is below: CODE:.............

View 4 Replies View Related

Android :: AlarmManager On Droids

Mar 10, 2010

I am using alarmmanager in my app. It works perfectly for Nexus One and wakes the phone up everytime the alarm fires. But for droid it seems that the phone doesn't wakeup, is there an extra setting on the phone which can prevent the phone from waking up?

View 22 Replies View Related

Android :: Cancle AlarmManager

Jun 14, 2009

alarms.set(AlarmManager.RTC_WAKEUP, getTime(), alarmIntent);

I have set a alarm,but now i want to delete it? how can i make it.

View 3 Replies View Related

Android :: AlarmManager And BootReceiver

Feb 24, 2010

I think I'm reading some conflicting statements about the AlarmManager on the Android docs website. The following statements both exist on this page:

http://developer.android.com/reference/android/app/AlarmManager.html

[at the top]

"Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted."

- and -

[under setRepeating()]

"This alarm continues repeating until explicitly removed with cancel(PendingIntent)"

So, the question is, do I need to register a BootReceiver that re-sets my Alarms when the phone turns on. The first statement makes me think I do, but the second statement is worded in a way that would lead one to believe that it would live forever, unless a cancel() call on that Intent is called.

So, which statement do I believe or am I misinterpreting one of the statements? I suppose when the power is turned off or back on, Android itself could call the cancel() function on all alarms. I guess it would help if it said that after the second sentence.

View 2 Replies View Related

Android :: Code To Use AlarmManager

Jul 4, 2009

Show me some sample code on how to use an AlarmManager in android.

I have been playing around with some code for a few days and it just won't work...

I need to trigger a block of code after 20 minutes from the AlarmManager being set.

View 1 Replies View Related

Android :: AlarmManager.RTC Not Working

Mar 3, 2010

I changed AlarmController.java in ApiDemo a little bit, so I want the alarm not to go off when the phone is sleeping by using AlarmManager.RTC.

CODE:.................

The receiver code is like below:

CODE:..............

I ran the modified app, but I still see many log messages as below after the phone wento sleep (the screen was black):

CODE:...............

This means the flag AlarmManager.RTC didn't work.

View 1 Replies View Related

Android :: Stopping AlarmManager.

Apr 5, 2010

I have a AppWidget, after I delete it from HomeScreen it seems not stopping the AlarmManager attached with it. I have supported it with the AlarmManger, that call the ProviderImplementation class every 1 minute and in onReceive I put the code to call onUpdate. and in onDelete I explicitly stop the alarm, but it seems it is running continously and not stopping. any cure of it ?

I have stopped it with cancel(pendingintent) function.

View 2 Replies View Related

Android :: AlarmManager Or Timer

Jul 22, 2010

I have a service that I need to execute every two minutes. Would it be more efficient to use an alarm or a timer?

View 3 Replies View Related

Android :: Intents Alarmmanager

Aug 7, 2010

I am trying to create intents that will be set using alarmmanager. Currently, I can do this with one intent, add extra data to it (strings, but i send them as one string with a seperator), and everything works fine and goes off at the correct time. However, when I try to send multiple intents like this, they are overwritten and only one goes off at the correct time. How can i structure my intents so that they appear different to the alarmmanager (i think they are getting deleted when filterIntent() is run).

long story short- putExtra() makes all the intents look the same still... how can i make them look different so they wont get deleted (and keep track of them in case i want to delete a specific one)

View 2 Replies View Related

Android :: App Widget With AlarmManager

Sep 6, 2010

I've created a simple app widget for personal use that queries a site from the internet, parses the XML received and displays some info from it. I'm using a Droid X, if that makes a difference; both in the emulator and as physical hardware, developing in the Android version of the MotoDev IDE.

No matter what I put in updatePeriodMillis, the shortest refresh time I can get is 30 minutes (I thought this was a 1.6 only bug but apparently not since I'm running 2.1) and I want it to refresh every 5 minutes, with some caveats. I don't want the widget to refresh when the screen is off and I want it to refresh immediately upon waking up the screen. My search for information says to set updatePeriodMillis to 0 and use the AlarmManager instead, but I can't find any complete code examples on just how to do this.

Obviously, I'm new to Android development, and Java in general actually, but I've been a developer for a very long time with experience in just about every other language. Currently working in C#, so I thought I'd be able to jump in fairly easily. Can anyone point me to sample code or an open source project that does what I'm looking for? I have other questions, but until I get this piece working they don't really matter. :)

View 5 Replies View Related

HTC EVO 4G :: Hotspot Timing Out When Trying To Connect / Stop It?

Jun 8, 2010

Is anyone else having issues with connections to the hotspot timing out when trying to connect or when already connected? I have tried to search around before posting but even most of my friends haven't come across this issue yet.

Trying to connect with a winxp laptop and a mac laptop. Tried open, WPA and WPA2.

View 8 Replies View Related

Android :: AlarmManager Not Firing Receiver

Feb 27, 2010

Any experts on AlarmManager out there?I've got something weird going on.The basic code to set my repeating alarm works fine. I can close my app and the alarm will continue to run like clockwork every five minutes. It works fine only if I set it in the app and then close the app.I've got a registered BootReceiver for re-registering the repeating alarm. I know it fires on boot b/c the log message clearly shows it is firing and re-setting the repeating alarm in question for the same frequency. But the AlarmManager is not firing.Basically, the nearly identical code for setRepeating() fires when set from the app and continues to run when the app is closed, so I know my AlarmReceiver is functioning, but the AlarmManager is either not broadcasting this alarm or my receiver doesn't work from an alarm set in the boot receiver.

View 9 Replies View Related

Android :: AlarmManager Problems In Milestone

Jun 11, 2010

I'm having some strange behavior of wakeup alarms scheduled by AlarmManager in Motorola Milestone (Droid in US). The thing is that they don't wake the device as they should. The same piece of code works fine in Samsung Galaxy and the alarms are fired as they should fire. In Milesstone when the device is in sleep no alarms are fired but all the alarms are fired at once when the device wakes up. I also found out that Milestone doesn't have the /proc/wakelocks file to check the wake lock info but I'm not sure if that has something to do with the problem. For this scenario there is no reason to acquire a wakelock because the AlarmManager acquires it automatically for lifetime of the OnAlarmReceive. I found some other threads about the same problem in Droid/Milestone, but does anybody have an idea what is the problem and is there anyway to solve it.

This is the code that I'm using to test this.

CODE:................

View 2 Replies View Related

Android :: BG Threads With 1.6 - AlarmManager Starving

Oct 30, 2009

I have a question about the background thread handling change that went into SDK 1.6. I read here that BG threads get placed in a scheduling class that can't use more than 5-10% of the CPU in order to keep the foreground responsive. Do system services get into that scheduling class?

My app uses repeating alarms. It was great with 1.5, very reliable. Since the upgrade to 1.6, the phone seems to be dropping some of my repeating broadcasts, especially if I am doing something fun in the foreground like with WIFI when the Alarm is supposed to fire. I do not have any of the task killer programs that have been a hot topic lately. To be clear, the dropped alarm broadcast behavior is intermittent. I am not 100% sure if I really am doing something when it has failed. If the timer is a one shot, it seems to work better but there is no real empirical evidence here. My phone is usually in my pocket when I fire one of the one shot alarms. If my theory about system services in the background scheduling class is correct, then I probably cannot find a workaround or defensively code a solution. Will it be the same in 2.0?

Have others seen issues with alarms and with the setRepeating method? I am looking for suggestions to troubleshoot this problem. How can I determine if the problem is the broadcast, if it is the repeating alarm creation, or if there is some other issue like low memory coming in to play.

View 13 Replies View Related

Android :: Leaked Intent And AlarmManager

Aug 27, 2010

I am trying to create authentication system which pops up the login window if the device has been off (SCREEN_OFF) for more than INTERVAL.

I have registered a BroadcastReceiver to listen to SCREEN_ON/OFF events in the onCreate() of the launchable activity:

code:..............

When the alarm goes off, the program crashes:

code:..............

View 1 Replies View Related

HTC Incredible :: New Root Method / No More SD - Card Timing

Jul 14, 2010

Closed, starting a new thread for development. Doesnt work as it stands, check out the other thread for more info

View 49 Replies View Related

HTC Desire :: Giving 8 To 9 Hour Battery Timing

Sep 21, 2010

Managing just 8-9 hrs with ny battery, and believe me I barely use the phone! Just a few calls, few texts, 5 min Internet, 5 min face book - thats it. I have everything turned off that I can turn off. Come on HTC sort it out - this is obviously by far the worst criticism you have.

View 7 Replies View Related

HTC Droid Eris :: How To Increase Bettery Timing?

May 30, 2010

I am new to the droid family. I bought the Eris Droid about 2 months ago. I wanted to be able to chat with my family, get on facebook, have directions to places my husband refuses to get directions for. A little bit of everything and the droid fits me perfectly. EXCEPT I'm really not liking the battery life. I fully charged in late yesterday, didn't use it much since and this am the battery is almost depleted. I changed some settings on my incoming mail and cleared cache. What else am I missing? I hope a stronger longer lasting battery will be forthcoming.

View 11 Replies View Related

Motorola Droid X :: Battery Timing About 14 Hours Only

Jul 16, 2010

I purchased my DX yesterday, used it for about 20 minutes then let it charge until about an hour after or more after it said it was done charging. Did I do this incorrectly? Because I only got about 14 hours worth of battery time. I was very data intensive last night.

View 5 Replies View Related

HTC EVO 4G :: Stop Screen From Timing Out During A Phone Call

Jul 6, 2010

New EVO user here as of last Friday. I've done a ton of searching, watching and reading and I have a couple questions to the experts out there.

Please let me know if there is a way to stop the screen from timing out (going dark) during a phone call. I find it annoying to have to hit the power button to get the screen back..

I'm using earbuds so the phone isn't near my face and it recognizes the phones as I can see the headset icon. I keep the phone on my desk and the screen times out almost immediately after I make a call and accept an incoming call. It's extremely annoying since I make a ton of work calls and I need to either navigate through an auto attendant and / or leave a message. All of which I have to hit the power button every single time I want the screen to turn back on. I have noticed that the volume buttons turn the screen back on as well.

The screen timeout is set at 2 minutes under the "Sound & Display" category but that doesn't effect the screen time out during a call. Anyone out there have a solution?

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved