msg.send is putting a 1 in front of the number

anaylor01

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Process_Globals
  Dim TimerService As Timer
  Dim Counter As Int 
  Counter=0    
    Dim sql1 As SQL
    Dim msg As PhoneSms
    Dim number As Long
    Dim Prefix As String
    Dim number1 As Double
    Dim tick As Int
    Dim number2 As String
End Sub

Sub Service_Create
  TimerService.Initialize("TimerService",1000)
  TimerService.Enabled=True
End Sub

Sub Service_Start
   SQL1.Initialize(File.DirDefaultExternal, "PhoneNumber.db", True)
number1 = SQL1.ExecQuerySingleResult("SELECT min(number) FROM TpNumbers where sent = 'NO'")
Prefix = SQL1.ExecQuerySingleResult("SELECT min(Prefix) FROM Prefix")
number2 = "213" & prefix & NumberFormat2(number1,4,0,0,False)
End Sub

Sub TimerService_Tick
msg.Send(number2, "Free Android App" & CRLF & "https://market.android.com/details?id=appinventor.ai_anaylor01.VoiceNotesTrial")
SQL1.ExecNonQuery2("update TpNumbers set Sent = 'Yes' where number = ?",Array As Long(NumberFormat2(number1,4,0,0,False)))
number1 = SQL1.ExecQuerySingleResult("SELECT min(number) FROM TpNumbers where sent = 'NO'")
Prefix = SQL1.ExecQuerySingleResult("SELECT min(Prefix) FROM Prefix")
number2 = "213" & prefix & NumberFormat2(number1,4,0,0,False)
If   NumberFormat2(number1,4,0,0,False) = 9999 Then
SQL1.ExecNonQuery2("delete from Prefix where Prefix = ?",Array As Int(Prefix))
SQL1.ExecNonQuery("update TpNumbers set Sent = 'NO'")
Prefix = SQL1.ExecQuerySingleResult("SELECT min(Prefix) FROM Prefix")
number1 = SQL1.ExecQuerySingleResult("SELECT min(number) FROM TpNumbers where Sent = 'NO'")
number2 = "213" & prefix & NumberFormat2(number1,4,0,0,False)
End If
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
The problem is is that it isn't seeing the number as as string. It is some kind of conversion problem. But for the life of me I can't see where the problem is. I have made a variable of Number2 as string and use that as the text number but it still isn't working.
 
Upvote 0
Top