mirror of
https://github.com/cheveguerra/FLP_2.0.git
synced 2026-04-21 05:09:24 +00:00
4/1/2024 - Se puso codigo de prueba para guardar en bitacora llamadas entrantes y salientes
This commit is contained in:
62
Starter.bas
62
Starter.bas
@@ -23,6 +23,15 @@ Sub Process_Globals
|
||||
Dim devModel As String
|
||||
Dim lastLocUpdate As String = 0
|
||||
Dim logger As Boolean = True
|
||||
|
||||
Dim PE As PhoneEvents
|
||||
Dim PhId As PhoneId
|
||||
|
||||
Dim callStartTime, callEndTime As Long
|
||||
Dim isIncoming As Boolean
|
||||
Dim lastState As String = "IDLE"
|
||||
Dim savedNumber As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
@@ -30,6 +39,9 @@ Sub Service_Create
|
||||
'This is a good place to load resources that are not specific to a single activity.
|
||||
Subs.revisaBD
|
||||
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para FirebaseMessaging
|
||||
|
||||
lastState = "IDLE"
|
||||
PE.InitializeWithPhoneState("PE",PhId)
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
@@ -60,6 +72,7 @@ End Sub
|
||||
|
||||
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
|
||||
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
||||
Subs.bitacora($"ERROR -> ${Error}"$)
|
||||
Return True
|
||||
End Sub
|
||||
|
||||
@@ -69,9 +82,56 @@ Sub Service_Destroy
|
||||
End Sub
|
||||
|
||||
Sub restartTracker
|
||||
Log("Llamamos RESTART-TRACKER")
|
||||
If logger Then Log("Llamamos RESTART-TRACKER")
|
||||
Subs.bitacora("Llamamos RESTART-TRACKER")
|
||||
StopService(Tracker)
|
||||
Sleep(1000)
|
||||
StartService(Tracker)
|
||||
End Sub
|
||||
|
||||
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
|
||||
'Incoming call- goes from IDLE To RINGING when it rings, To OFFHOOK when it's answered, to IDLE when its hung up
|
||||
'Outgoing call- goes from IDLE To OFFHOOK when it dials out, To IDLE when hung up
|
||||
Log($">>>>> Phone State Changed -> ${State} -> "$ & IncomingNumber)
|
||||
If IncomingNumber = "" Then
|
||||
Return
|
||||
End If
|
||||
Log($">>>>> Phone State Changed 2 -> ${State} -> "$ & IncomingNumber)
|
||||
Select State
|
||||
Case "RINGING"
|
||||
'calling in progress
|
||||
isIncoming = True
|
||||
callStartTime = DateTime.Now
|
||||
savedNumber = IncomingNumber
|
||||
Subs.bitacora($"RINGING - ${IncomingNumber}"$)
|
||||
Exit
|
||||
Case "OFFHOOK"
|
||||
'Transition of ringing->offhook are pickups of incoming calls. Nothing donw on them
|
||||
If lastState <> "RINGING" Then
|
||||
'outgoing call start
|
||||
isIncoming = False
|
||||
callStartTime = DateTime.Now
|
||||
Subs.bitacora($"OFFHOOK - ${savedNumber}"$)
|
||||
End If
|
||||
Exit
|
||||
Case "IDLE"
|
||||
'Went to idle- this is the end of a call. What type depends on previous state(s)
|
||||
If lastState = "RINGING" Then
|
||||
'missed call
|
||||
callEndTime = 0
|
||||
Subs.bitacora($"IDLE - Missed call (${IncomingNumber}): ${callEndTime}"$)
|
||||
else if isIncoming Then
|
||||
'incoming call is finished
|
||||
callEndTime = DateTime.Now
|
||||
Subs.bitacora($"IDLE - Incoming call is finished (${IncomingNumber}): ${callEndTime}"$)
|
||||
Else
|
||||
'outgoing call is finished
|
||||
callEndTime = DateTime.Now
|
||||
Subs.bitacora($"IDLE - Outgoing call is finished (${IncomingNumber}): ${callEndTime}"$)
|
||||
End If
|
||||
Exit
|
||||
End Select
|
||||
lastState = State
|
||||
|
||||
'Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber & "; PhoneFlag = " & PhoneFlag)
|
||||
End Sub
|
||||
Reference in New Issue
Block a user