Is there a way to play an audio while the Kivy application is loading while running on Android devices? That is play an audio while the presplash image, defined in the buildozer.spec file, is displayed on the screen.
As @inclement answered, this is by editing the Java code executed when the presplash image is displayed. The way to do that is simple.
Here is the modified onCreate() method for playing audio by passing its location in the device:
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.v(TAG, "My oncreate running");
resourceManager = new ResourceManager(this);
Log.v(TAG, "About to do super onCreate");
super.onCreate(savedInstanceState);
Log.v(TAG, "Did super onCreate");
this.mActivity = this;
Toast.makeText(this, "Working on the Kivy Project in Android Studio", Toast.LENGTH_LONG).show();
this.showLoadingScreen();
new UnpackFilesTask().execute(getAppRoot());
MediaPlayer music = new MediaPlayer();
try {
music.setDataSource("/storage/emulated/0/music.mp3");
music.prepare();
music.start();
} catch (IOException e) {
e.printStackTrace();
}
}