Sub SendLargeSms(Destination As String, Message As String)
Dim r As Reflector, t As Long, ts As Int
mod_functions.writelog("svc_sms(),SendLargeSms")
Main.CALLSTATE.sms_busy = True
Try
' // calc the part
ts = Round(Message.Length / 160)
ts = ts * 7 ' parts * seconds = totals seconds to wait, 7 represents 1 short message send in seconds
r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
Dim parts As Object
parts = r.RunMethod2("divideMessage", Message, "java.lang.String")
r.RunMethod4("sendMultipartTextMessage", _
Array As Object(Destination, Null, parts, Null, Null), _
Array As String("java.lang.String", "java.lang.String", _
"java.util.ArrayList", "java.util.ArrayList", "java.util.ArrayList"))
' // calc seconds to wait
t = DateTime.Add(DateTime.Now + (DateTime.TicksPerSecond * ts),0,0,0)
mod_functions.writelog("svc_sms(), Sending Long SMS to " & Destination & ", " & DateTime.Time(t))
' // wait here for device to send large SMS
Do While t > DateTime.Now
DoEvents
Loop
' // remove the message if it is the outbox - this can occur on some phones
mod_functions.manage_sms(s.mobile_number,s.message_1,sm.TYPE_OUTBOX,1)
If paused Then
Main.CALLSTATE.sms_paused = True
End If
Catch
mod_functions.logError("svc_sms(),SendLargeSms, " & LastException.Message )
End Try
Main.CALLSTATE.sms_busy = False
End Sub