Reputation: 181
I'm planning to make an app that enables the Mobile Data of the android every X hours for Y minutes. I was wondering which class should I use to schedule this task. Thanks
Upvotes: 1
Views: 235
Reputation: 82533
For tasks for which the user can give you a specific time and date, you can use AlarmManager to have your task executed at that time.
This way, your app does not need to be running the whole time, and will be launched by Android when the time comes.
You can even use the setRepeating() method to set it only once and have it run everytime.
Upvotes: 2