Friday, November 16, 2012

[android-developers] How to run a service from 9 AM to 4 PM daily?

Question :1 => 
I want to run a service from 9 AM to 4 PM daily. I plans two method.Which one is best?

Method 1:
Inside Service:(This service initialized at on create of activity when first time application starts)

 if (9 AM <=current time<=4 PM)
{
  fetch data from server. 
}

Method 2:
In Activity oncreate use Alarm manager and start a service based on the alarm manager.Then wake up next day  and start service.

Which method is best?

Question :2 => How to find a service is running or not programmatically?
--
BY

R.RAMPRASAD


--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate