I am not able to send an sms with PhoneSMS library. My android version is 4.2.2.
My code runs from a service module. This is my code:
It speaks all the TTS commands, it does not hung but it does not play either the mp3.
Are there any problems running the code in a service? The SMS never reaches each destination so I suppose I do not send it. The variable sCoords is defined in Process_Globals and gets its value from another sub. Any ideas?
My code runs from a service module. This is my code:
B4X:
Sub SendSMS()
Dim pSMS As PhoneSms
Dim cur As Cursor = Main.conn.ExecQuery("SELECT * FROM [00_AppOptions]")
cur.Position = 0
Dim sSMS As String
ts.SetLanguage("en", "US")
ts.Speak("Entered in Send SMS event.", False)
sSMS = cur.GetString("SMSToSend")
cur = Main.conn.ExecQuery("SELECT PhoneNumber FROM [01_NumbersForSMS]")
cur.Position = 0
Dim ii As Int
Dim jj As Int
Dim sNumber As String
For ii = 0 To cur.RowCount - 1
Dim sNumber2 As String
cur.Position = ii
sNumber = cur.GetString("PhoneNumber")
sNumber2 = ""
For jj = 0 To sNumber.Length - 1
sNumber2 = sNumber2 & sNumber.CharAt(jj) & " "
Next
ts.Speak("Sending to " & sNumber2, False)
pSMS.Send(sNumber, sSMS & " - " & sCoords)
Next
cur.Close
Dim sp As SoundPool
sp.Initialize(1)
Dim iID As Int
iID = sp.Load(File.DirAssets, "strings2.mp3")
sp.Play(iID,1,1,100,1,2)
End Sub
It speaks all the TTS commands, it does not hung but it does not play either the mp3.
Are there any problems running the code in a service? The SMS never reaches each destination so I suppose I do not send it. The variable sCoords is defined in Process_Globals and gets its value from another sub. Any ideas?