Android Example background voice recording

Hi..
I have created one activity that contains AudioRecorder using audiorecorder library.
i want to start and stop recording from background using service.
timer is not working to stop AudioRecorder.

Main :
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer1 As Timer
Timer1.Initialize("Timer1",1000)
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim AR As AudioRecorder

Private CheckBox1 As CheckBox
Private CheckBox2 As CheckBox
Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("x1")
If FirstTime Then
Timer1.Enabled=True
StartService(codeset)
End If
Activity.AddMenuItem("Prepare","mnuPrepare")
Activity.AddMenuItem("Start","mnuStart")
Activity.AddMenuItem("Stop","mnuStop")
Activity.AddMenuItem("isRecording","mnuisRecording")
End Sub



Codeset (service Module) :
#Region Service Attributes
#StartAtBoot: True
#End Region

Sub Process_Globals
Dim TimerService As Timer
Dim Counter As Int
Counter=0
Dim AR As AudioRecorder
End Sub

Sub Service_Create
TimerService.Initialize("TimerService",1000)
TimerService.Enabled=True
End Sub

Sub Service_Start
Counter=Counter+1
If Counter = 50 Then
AR.STOP
End If

End Sub
Sub OpenApp
Dim i As Intent
i.Initialize("", "")
i.SetComponent("com.rootsoft.audiorecorder/.cv")
StartActivity(i)
' PushActivity(i)
End Sub
Sub TimerService_Tick
StartServiceAt("", DateTime.Now, True)
End Sub
 
Top