Reputation: 85
I have implemented service activity in my app which is i want to fetch the data in the background of application while my app is not opened infront.But right now i want to start the service at particular or specific time like today my service is start at 12pm , after that my service is start at 12am everyday, how to do this.Can someone help me.Thanks to appreciate.
Upvotes: 1
Views: 1141
Reputation: 771
As the comments state, AlarmManager
is the class you're looking for. However it's not a great idea to start a service at an EXACT time, because if your app is popular and you have a million users, they're all going to hit your backend at exactly midday every day... Read more about the right way to do it here:
https://developer.android.com/training/scheduling/alarms.html
Upvotes: 1