Hello,
i try to event incoming call with a service but the application crash
Here my code:
i try to event incoming call with a service but the application crash
Here my code:
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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 Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout("test")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
StartService(call)
End Sub
B4X:
'Service module
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
' Dim PhoneId As Phoneid --> unknown?
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
' PE.InitializeWithPhoneState("PE", PhoneId) --> unknown?
PE.Initialize("PE")
End Sub
Sub Service_Destroy
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log(state)
If state="RINGING" Then
Msgbox(IncomingNumber,"")
End If
End Sub