#Region Service Attributes
#StartAtBoot: False
#StartCommandReturnValue: android.app.Service.START_STICKY
#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 Icone As Notification
Dim Test As PhoneSensors
Dim Tel As Phone
End Sub
Sub Service_Create
Icone.Initialize
Icone.Icon = "icon"
Test.Initialize(Test.TYPE_PROXIMITY)
Test.StartListening("Test")
StartServiceAt("", DateTime.Now, True)
End Sub
Sub test_SensorChanged (Values() As Float)
If Values(0) >0 Then
Tel.SetRingerMode(Tel.RINGER_NORMAL)
Else
Tel.SetRingerMode(Tel.RINGER_VIBRATE)
End If
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(1,Icone)
End Sub
Sub Service_Destroy
Service.StopForeground(1)
End Sub