Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized Then
Dim cs As CSBuilder
cs.Initialize.Bold.Size(20).Append($"Action: ${StartingIntent.Action}"$).PopAll
Log(cs)
If StartingIntent.Action="Pause" Then Stop
If StartingIntent.Action="Play" Then Play
If StartingIntent.Action="finish" Then
Stop
CallSub(Main,"subfinish")
End If
End If
Service.StopAutomaticForeground
End Sub
Public Sub Play
Service.StartForeground(nid, CreateNotification("Playing music - Radio Paradise"))
pl.Prepare(pl.CreateUriSource("http://stream.radioparadise.com/aac-128"))
pl.Play
MediaStyle_Notification
End Sub
Sub MediaStyle_Notification
Dim n As NB6
n.Initialize("default", Application.LabelName, "LOW").SmallIcon(smiley)
n.AddButtonAction(smiley, "Action 1", Me, "Play") 'use different bitmaps...
n.AddButtonAction(smiley, "Action 2",Me, "Pause")
n.AddButtonAction(smiley, "Action 3", Me, "Finish")
n.MediaStyle
n.Build("", "", "tag", Me).Notify(1)
end sub
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.SetInfo("Radio Paradise", Body, Main)
Return notification
End Sub