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 Phoneid1 As PhoneId
Dim Lista As List
Dim N1 As String
Dim Caller As String
End Sub
Sub Service_Create
Pe.InitializeWithPhoneState("Pe",Phoneid1)
Lista.Initialize
N1 = ("333xxxxxxxxx")
Log("Service created")
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("Service started")
End Sub
Sub Service_Destroy
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
Log ( "statechnaged " & State & " " & IncomingNumber )
Log ("intent " & Intent )
If IncomingNumber.Contains(N1) Then
Caller = IncomingNumber
CallSubDelayed2(Main,"InfoCall",IncomingNumber)
KillCall
End If
End Sub
Sub KillCall
Dim r As Reflector
r.Target = r.GetContext
Dim TelephonyManager, TelephonyInterface As Object
TelephonyManager = r.RunMethod2("getSystemService", "phone", "java.lang.String")
r.Target = TelephonyManager
TelephonyInterface = r.RunMethod("getITelephony")
r.Target = TelephonyInterface
r.RunMethod("endCall")
End Sub