Sub Service_Start(startingIntent As Intent)
If startingIntent.Action = "android.provider.Telephony.SMS_RECEIVED" Then
SMSList.Initialize
ParseSmsIntent(startingIntent)
For i = 0 To SMSList.size - 1
Dim SMSMap As Map
SMSMap=SMSList.Get(i)
Log(SMSMap.Get("address"))
Log(SMSMap.Get("body"))
Log(SMSMap.Get("time"))
ParseSingleSMS(SMSMap.Get("address"),SMSMap.Get("body"))
Next
End If
Sub ParseSmsIntent (in As Intent)
If in.HasExtra("pdus") = False Then Return
Dim pdus() As Object
Dim r As Reflector
pdus = in.GetExtra("pdus")
If pdus.Length > 0 Then
For i = 0 To pdus.Length - 1
r.Target = r.RunStaticMethod("android.telephony.SmsMessage", "createFromPdu", _
Array As Object(pdus(i)), Array As String("[B"))
Dim SMSMap As Map
SMSMap.Initialize
SMSMap.put("address", r.RunMethod("getOriginatingAddress"))
SMSMap.put("body", r.RunMethod("getMessageBody"))
SMSMap.put("time", r.RunMethod("getTimestampMillis"))
SMSList.Add(SMSMap)
Next
End If
End Sub
End Sub