Reputation: 17788
I have an app with an integrated music player. This player plays music in a service...
Now my app is a sports app, so the user listens to music and sometimes, timer events occur and play a alarm sound. I want to use the service for playing these sound because I want to stop the normal music, play the alarm and resume the music.
My problem is, sometimes (not very often), there is a quite long delay... Of some seconds...
How can I avoid this?
Btw., I implemented a Do-Not-Disturb Mode, so I can't use audio focus if this mode is enabled. I have to manually pause the player only for internal alarms and resume afterwards...
Upvotes: 0
Views: 458
Reputation: 4733
You could start the Service
at the boot, and then simply bind to it whenever you need it. Checkout the docs to learn how a Service works.
Upvotes: 1