#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim PE As PhoneEvents, tPhoneId As PhoneId
End Sub
Sub Service_Create
' Initializes the PhoneStateListener.
' All data is also outputted to the filtered log field.
'------------------------------------------------------
PE.InitializeWithPhoneState("PE", tPhoneId)
ToastMessageShow("Starting Phone State Service.",False)
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
' Misc Subs.
'-----------
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Select State
Case "0" ' Idle state.
ToastMessageShow("Chimes have now been enabled again.",False)
ChimeService.blnPhoneIsInUse = False
Case "1" ' Ringing state.
ToastMessageShow("Chimes have now been disabled while the phone is in use.",False)
ChimeService.blnPhoneIsInUse = True
Case "2" ' Off the hook state.
ToastMessageShow("Chimes have now been disabled while the phone is in use.",False)
ChimeService.blnPhoneIsInUse = True
ToastMessageShow("blnPhoneIsInUse = " & ChimeService.blnPhoneIsInUse,False)
' We don't want the chimes to be interupting the phone when it's being used.
'---------------------------------------------------------------------------
If ChimeService.mpMediaPlayer.IsPlaying = True Then
ChimeService.mpMediaPlayer.Stop
End If
End Select
End Sub