SMS is not sent

Amalkotey

Active Member
Licensed User
Longtime User
Hello,

with the following code I wanted to send a text message. But the wid SMS not sent and I do not know why. Thank you for your help in advance.

best regards
Amalkotey

B4X:
Dim Sms As PhoneSms
Dim Number As PhoneId
Dim Zeile As List
Dim Order As String

Zeile.Initialize
Zeile.Add("Hiermit bestelle ich die Software " &  spnProdukte.SelectedItem)
Zeile.Add(CRLF & CRLF)
Zeile.Add("Name     : " & tbName.Text & CRLF)
Zeile.Add("eMail    : " & tbMail.Text & CRLF)
Zeile.Add("Strasse  : " & tbStreet & CRLF)
Zeile.Add("Anschrift: " & tbPLZ & " " & tbOrt & CRLF)
Zeile.Add("Country  : " & spnCountry.SelectedItem & CRLF)
Zeile.Add("Rufnummer: " & number.GetLine1Number)

Order = ""
For i = 0 To Zeile.Size - 1
   Order = Order & Zeile.Get(i)
Next

If (chbSMS.Checked = True) Then
   If (Msgbox2("Bestellung senden","Bestellung", "ok", "", "Abbruch", Null) = DialogResponse.POSITIVE) Then
       Sms.Send("+4915252164550", Order)
   End If
Else
   ' eMail
End If
 

Amalkotey

Active Member
Licensed User
Longtime User
Assumption: the string could be too long for an sms.

@Dejmbefola:
I 'm from Germany and my provider is telecom. on the help pages on the web read the telecom, the SMS may have up to 1350 characters, which at max. Be divided - 9 individual SMS messages - with 154 characters. But, thanks for the hint. I will test times.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Upvote 0

Amalkotey

Active Member
Licensed User
Longtime User
@All:
Thanks for the help.

I 've now changed my code so I list the length of the SMS message, and if the message is too long, put on a meaningful two news SMS splitting.

B4X:
Order = ""
For i = 0 To Zeile.Size - 1
   Order = Order & Zeile.Get(i) & CRLF
   If (i = 1) Then
      factor = Order.Length
   End If
Next
If (chbSMS.Checked = True) Then
   If (Order.Length > 159) Then
      txt = "Ihre Daten in der SMS sind grösser als 160 Zeichen." & CRLF & _
              "Es werden zwei Bestell-SMS gesendet. Bestellung trotdem senden?"
   Else
      txt = "Bestellung senden?"
   End If
   If (Msgbox2(txt, "Bestellung", "ok", "", "Abbruch", Null) = DialogResponse.POSITIVE) Then
      If (Order.Length > 159) Then
         SMS1 = Order.SubString2(0, factor - 1)
         SMS2 = Order.SubString2(factor, Order.Length - 1)
         Sms.Send("+4916096682220", SMS1)
         Sms.Send("+4916096682220", SMS2)
      Else
         Sms.Send("+4916096682220", Order)
      End If      
      Global.GotoTheWeb(4)
   End If
Else
   ' eMail
End If
 
Upvote 0

samperizal

Active Member
Licensed User
Longtime User
Greetings.

The SMS are limited in what the size is concerned. This limitation corresponds to 160 characters if you do not use special characters such as ñ, ó, á, etc ... and 60 if you use these characters. This is due to the type of encoding used.

Normally all operators admit more characters but must say that the message is multipart so that the operator will split into several messages. Other solution is to control yourself and be yourself in subdividing many messages as needed.

I hope it is helpful ..

P.S. The sorry for my English.
 
Upvote 0
Top