Sub Process_Globals
Dim MediaPlayer1 As MediaPlayer
End Sub
Sub Globals
Dim counter As Initialize
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
MediaPlayer1.Initialize( )
MediaPlayer1.Load(File.DirAssets, "track1.mp3") ' mid, mp3 or ogg file
End If
End Sub
Sub Activity_Resume
counter = counter + 1 ' Resume is called when starting the app as well so we better keep track on the number of resumes
' Change the music the first time that we're doing an actual resume
If counter = 2 Then MediaPlayer1.Load(File.DirAssets, "track2.mp3")
MediaPlayer1.Play
Log ("Resume is now running and counter contains:")
Log (counter)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If MediaPlayer1.IsPlaying Then MediaPlayer1.Pause
End Sub