Audio files

Any audio file that is supported by Android can be used.


The engine provides a service to easily play sounds or implement a new audio service by implementing the interface AudioService.

The following example shows how to use the audio service locator to provide an audio service throughout your app, decoupling graphics and sound.

For the initialization:

AudioService audioService = new SoundWorkerImpl(getApplicationContext(), 5);

The default implementation SoundWorkerImpl of the engine is used here, which lets us specify the maximum number of sounds that can be played simultaneously (it's set to 5 here). After that, we use the AudioServiceLocator class to provide this newly created service.

To use this service in any part of your app you simply call:

AudioService audioService = AudioServiceLocator.getAudioService();

Now you can use audioService to access the features provided by this interface.

Play sounds

Play background music