Thanks KZero,
Here is the code that I added.
The service is starting ok, but the event is not triggered when I lock the phone.
#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 PhoneId As PhoneId
Dim PE As PhoneEvents
End Sub
Sub Service_Create
PE.InitializeWithPhoneState("PE", PhoneId)
Log("Phone State detected service." )
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("Phone State detected service Started.")
End Sub
Sub Service_Destroy
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log("This phone is " & State & ".")
End Sub
I am also requesting the corresponding permission
Starter.rp.PERMISSION_READ_PHONE_STATE)
Any ideas?
Thank you