Setting interval to set for service

by sunitha » Wed, 11 Nov 2009 23:01:28 GMT


Sponsored Links
 Hi

I have to develop a service which runs in background. I do need to
keep some logic in the service to run for every 10 minutes. Is there
any way to set time interval.

--



Setting interval to set for service

by RichardC » Wed, 11 Nov 2009 23:05:15 GMT


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

Also if you are waking the phone every 10mins to run your service you
will really drain the battery as the phone takes a while to go back to
sleep again.

--
RichardC




--


Sponsored Links


Other Threads

1. ClassLoader leaking memory?

I have a ClassLoader in Activity's onCreate which loads a specific
class from a library, and is working fine, except that when activity
is destroyed, the memory resources about the loaded class are not
released.

If the same activity gets created multiple times very quickly (by
launching it, and destroying it by pressing the Back button), and the
process doesn't happen to be killed by Android yet, the memory usage
of the corresponding process grows continuously until the app crashes,
and process dies.

The problem is that this happens even if no objects are instantiated
using the loaded class. There seems a problem with garbage collector,
which doesn't seem to release resources about the loaded class on
Destroy even if there are no references to it.

If android would have killed the process right away when the last
activity of the process gets finished, there wouldn't be a problem,
but this is managed by Android system, and it doesn't always kill the
process right away. A workaround may be to kill the process explicitly
on destroy, but this is not encouraged way to do, as Android is
supposed to manage the process.

An alternative is to have a functionality that allows a class to be
unloaded onDestroy, but this doesn't exist. By design, the garbage
collector is supposed to take care of this.

Is there a solution regarding this?

Thanks,

-- 

2. } catch (OutOfMemoryError E) {

Can I ask what Android does with un caught OutOfMemoryErrors that it
wouldn't do if I caught them?  It's really tempting for me to do this:

try {
            setContentView(R.layout.result);
} catch (OutOfMemoryError E) {
           outOfMemoryCount++;
             e.printStackTrace();
              finish();
}

If I don't catch the OutOfMemory my activity crashes, but then the
user just clicks the button again and it loads great the second time.
So something happens resulting in the right memory being cleared.

-- 

3. Enumerate activity history stack

4. Contacts App crashes when switching between Dialer to Call log

5. How To apply our settings to selected text instead of all text in Edit text View

6. Uninstalling TTS Data from the G1 / Dream

7. Connect via USB and consume web service