Re: [android-developers] Writing a Date/Time Service

2010-12-31 Thread TreKing
On Fri, Dec 31, 2010 at 7:35 AM, asinha asinha.vocoll...@gmail.com wrote:

 Is this the right way to write my service?


No. Use AlarmManager.


 How would I verify my service?


Test it?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Writing a Date/Time Service

2010-12-31 Thread Kostya Vasilyev

31.12.2010 16:35, asinha пишет:

I am trying to write a service which runs as background process and
invoke my task (in application) at 9am everyday.

My service is:

[snip]

Is this the right way to write my service? How would I verify my
service?


This is error-prone, since a service can get kicked out of memory at any 
time, and all threads (including the thread used by Java timers) will 
terminate.


Set an Alarm with AlarmManager, it avoids the issues caused by 
interference from process lifecycles:


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

--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en