Reputation: 5759
I have two background services in my application that are scheduled at regular intervals by the AlarmManager. The intervals are different for each service. I would like to run one service every two minutes, and the other service every 15 mins.
How can I prevent them from running at the same time?
If one Service is called while the other is running, I want it to run immediately after the first one finishes.
Upvotes: 0
Views: 134
Reputation: 1006744
I would like to run one service every two minutes, and the other service every 15 mins.
How can I prevent them from running at the same time?
You combine them into one service, running every N minutes, that does the less-frequent work every Mth time.
Upvotes: 4
Reputation: 14808
Schedule only one service which you want to start first and when this service finish start another service in onDestroy
of first service.
Upvotes: 0