'Service module
Sub Process_Globals
Dim PE As PhoneEvents
Dim AP As AnswerPhone
Dim P As Phone
End Sub
Sub Service_Create
PE.InitializeWithPhoneState("PE",PhoneId)
Log("Service created")
End Sub
Sub Service_Start
Log("Service started.")
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
ToastMessageShow("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber, True)
If State = "RINGING" Then
'State Silent Mode
P.SetRingerMode(P.RINGER_SILENT)
AP.answercall
ToastMessageShow("2 -- PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber, True)
End If
End Sub
Sub Service_Destroy
End Sub
......
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
ToastMessageShow("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber, False)
If IncomingNumber = "+3933XXXXXX" Then
If State = "RINGING" Then
AP.answercall
tempo.Initialize("tempo", 10000 )
tempo.Enabled = True
End If
End If
End Sub
Sub tempo_Tick
ToastMessageShow("Finito Tempo",True)
AP.endcall
tempo.Enabled = False
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
ToastMessageShow("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber, False)
If IncomingNumber = "+3933XXXXX" Then
If State = "RINGING" Then
P.SetRingerMode(P.RINGER_SILENT)
AP.endcall
End If
End If
End Sub