# Problem that came up while using the fmod in the android studio

**URL:** <https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731>\
**Category:** FMOD Engine\
**Created:** [October 4, 2016, 2:52pm UTC](https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731 "2016-10-04T14:52:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cronos123](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cronos123](https://qa.fmod.com/u/cronos123)\
**Post date:** [October 4, 2016, 2:52pm UTC](https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731/1 "2016-10-04T14:52:27Z")

</div>

Hello, I wanted to ask a question regarding a problem that came up while using the fmod in the android studio.

First, playing music with the fmod in the Activity and using other apps at the same time can be done just like in the Service. Could you explain how this can happen?

Second, I would like the next music to play automatically after the previous one, so is there a method that can point the ending of the music?

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [October 5, 2016, 2:27am UTC](https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731/2 "2016-10-05T02:27:13Z")

</div>

If you want to play audio in a background you have to use a service.

If you’re using studio you can find out when an instance has stopped playing using EventInstance::getPlaybackState, or by adding a callback with EventInstance::setCallback and waiting for FMOD\_STUDIO\_EVENT\_CALLBACK\_STOPPED. If you’re using the lowlevel you can query Channel::isPlaying() or use a callback passed the Channel::setCallback and wait for FMOD\_CHANNELCONTROL\_CALLBACK\_END.

---

<div class="post-metadata">

**Author:** ![cronos123](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@cronos123](https://qa.fmod.com/u/cronos123)\
**Post date:** [October 5, 2016, 11:25am UTC](https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731/3 "2016-10-05T11:25:25Z")

</div>

> [@](#):
>
> If you want to play audio in a background you have to use a service.
> 
> If you’re using studio you can find out when an instance has stopped playing using EventInstance::getPlaybackState, or by adding a callback with EventInstance::setCallback and waiting for FMOD\_STUDIO\_EVENT\_CALLBACK\_STOPPED. If you’re using the lowlevel you can query Channel::isPlaying() or use a callback passed the Channel::setCallback and wait for FMOD\_CHANNELCONTROL\_CALLBACK\_END.

Thanks for your reply. i understood second question’s reply. but in first quetion, i already knew that i have to use a service to play audio in a background. but when i play audio using activity, audio was also played in a background just like in the service. so i wondered how this can happen.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [October 5, 2016, 11:57pm UTC](https://qa.fmod.com/t/problem-that-came-up-while-using-the-fmod-in-the-android-studio/12731/4 "2016-10-05T23:57:30Z")

</div>

Audio will play in the background regardless of service vs activity.

For this reason we have System::mixerSuspend and System::mixerResume to stop this from happening. So if you want to play music in the background, simply don’t call suspend.
