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?