Trouble with Processing sound library. Processing looses the control over the audio output device after the Android activity was recreated

0

Short description:

I have created an android app with two activities. The main activity creates processing context. Processing plays every 3 second a short sound. The code is short and simple and placed here.

When the user taps the screen the app jumps to the second activity (standard clear activity) and in five seconds the app create the processing window again and jumps to the processing. But after that the sound can not be played more. And I have no errors in the console. What should I do? Have you the same trouble? Which library should I select instead of that?

Long description:

I integrated ads into my videogame, but in the previous months my ad mediator changed the SDK and now I can not simple show the ads in my processing activity. I need to create an another activity, show from it the ad, close the activity and create/recreate the processing activity again. And with this manipulations I can not more play any sounds. That’s why I created this simple project to find the trouble.

I expect to find a library for processing/java with android support to prevent the loosing of the control over the audio output after the activity was recreated