Hello,
i've got two Problems.
First, i have an application with an Activity, a MediaPlayer and a Layout "PlayerLayout".
I'm calling then MediaPlayer as a service because it should stay active in the background.
My Activity:
The Service:
After the Screen is locked, the Event MP_Complete never gets invoked.
I wanted to update the Player-GUI with a Timer in the Activity. Do i have to do this out of the Service?
Second Problem: i like do implement a Headphone control:
Is it possible to do this in a Service?
Thanks and Regards
i've got two Problems.
First, i have an application with an Activity, a MediaPlayer and a Layout "PlayerLayout".
I'm calling then MediaPlayer as a service because it should stay active in the background.
My Activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("PlayerLayout")
If FirstTime Then
playerService.MediaPlayer1.Initialize2("MP")
End If
End Sub
Sub MP_Complete
' Play next Song
End Sub
The Service:
B4X:
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
MediaPlayer1.Play
End Sub
Sub Service_Destroy
MediaPlayer1.Pause
End Sub
After the Screen is locked, the Event MP_Complete never gets invoked.
I wanted to update the Player-GUI with a Timer in the Activity. Do i have to do this out of the Service?
Second Problem: i like do implement a Headphone control:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = 79 Then
' next Song
End If
End Sub
Is it possible to do this in a Service?
Thanks and Regards