10-28-2014، 06:50 PM
من با دستور زیر میفهمم که گوشی زنگ خورده ولی نمیدانم چطور بفهمم مکالمه قطع شده و پایان یافته
کد:
Sub Process_Globals
Dim TimerService As Timer
Dim PE As PhoneEvents
Dim AC As AnswerCall
Dim PhoneId As PhoneId
Dim Counter As Int
Counter = 0
Dim Check1 ,Makan As Int
End Sub
Sub Service_Create
TimerService.Initialize("TimerService",1000)
PE.InitializeWithPhoneState("PE",PhoneId)
AC.Initialize("AnswerCall")
End Sub
Sub Service_Start (StartingIntent As Intent)
Check1 = File.ReadString(File.DirInternal, "chek1.txt")
Makan = File.ReadString(File.DirInternal, "makan.txt")
Counter = Counter + 1
If Counter = Makan Then
Counter = 0
If Check1 = 1 Then
TimerService.Enabled = False
End If
End If
End Sub
Sub Service_Destroy
End Sub
Sub TimerService_Tick
StartServiceAt("", DateTime.Now, True)
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
If AC.isRinging = True Then
TimerService.Enabled = True
End If
End Sub