﻿B4A=true
Group=Class
ModulesStructureVersion=1
Type=Service
Version=8.08
@EndOfDesignText@
#Region  Service Attributes 
	#StartAtBoot: False
	
#End Region

Sub Process_Globals
End Sub

Sub Service_Create
End Sub
 
Sub Service_Start (StartingIntent As Intent)
	If StartingIntent.IsInitialized Then
 		changePlay(StartingIntent.Action)
 	End If
 	
	Service.StopAutomaticForeground

End Sub
 
Sub changePlay(Action As String)
	
	Try
		Log(Action)
	
		Dim hh() As String = Regex.Split(";;",Action)
	
		Dim playP As String = hh(0)
		Dim wihSe As String = hh(1)
	
		Dim bill As Boolean
		If playP = "play" Then
			bill = True
		Else
			bill = False
		End If
 	
 
		Select wihSe
 				
			Case "book"
				If bill Then
					If Not(playServiceBook.playBook.IsPlaying) Then
						playServiceBook.playBook.Play
					End If
				Else
					If playServiceBook.playBook.IsPlaying Then
						playServiceBook.playBook.Pause
					End If
				End If
				
				CallSub(actBook,"ppBook")
				If IsPaused(actBook) Then
					func.savePFM("playBBook",-1)
				End If
				
			Case "book2"
				If bill Then
					If Not(playServiceBook.play2Book.IsPlaying) Then
						playServiceBook.play2Book.Play
					End If
				Else
					If playServiceBook.play2Book.IsPlaying Then
						playServiceBook.play2Book.Pause
					End If
				End If
				
				CallSub(actBook,"ppBook")
				If IsPaused(actBook) Then
					func.savePFM("playBBook",-1)
				End If
				
			 
				
		End Select

	Catch
		Log(LastException)
	End Try

End Sub

Sub Service_Destroy

End Sub
