How to send all messages received ...before using httputils2 i used following code....but it gave error like out of index so i decided to use httputils2
but now i am sticked at .downloadlist
& offline compatibility
please help
:sign0104:
:sign0144:
but now i am sticked at .downloadlist
& offline compatibility
please help
B4X:
'Service module
Sub Process_Globals
Dim PE As PhoneEvents
Dim SI As SmsInterceptor
Dim smsapi As String
Dim count As Int
Dim Job2Links,jb2 As List
Dim job1 As HttpJob
End Sub
Sub Service_Create
job1.Initialize("Job1", Me)
Job2Links.Initialize
jb2.Initialize
PE.Initialize("PE")
SI.Initialize("SI")
count=0
'Log("%%CREATE%%")
End Sub
Sub Service_Start
'Log("####START%%")
End Sub
Sub SI_MessageReceived (From As String, Body As String)
Dim su As StringUtils
Dim enTo,enmes,enat As String
Dim nrand,jb As Int
Dim dt As String
dt= DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now)
enTo = su.EncodeUrl(From, "UTF8")
enmes =su.EncodeUrl(Body, "UTF8")
enat =su.EncodeUrl(dt, "UTF8")
'WaitFor(10000)
'Log (dt)
Dim p As Phone
smsapi= "http://mydomain.com/putsms.php?from="& enTo & "&nrand="&nrand&"&sms=" & enmes & "&uid=" & p.GetSettings("android_id")& "&ver=42" & "&at=" & enat
Job2Links.Add(smsapi)
job1.DownloadList("GET Job2", Job2Links)
'HttpUtils.DownloadList("GET Job2", Job2Links)
'Log("##SIZE:"&Job2Links.Size)
'For i = 0 To count
'
'Log("##LIST:"&Job2Links.Get(i))
'Next
End Sub
Sub Service_Destroy
End Sub
Sub UrlDone(Url As String)
End Sub
Sub JobDone (Job As HttpJob)
Dim link As String
Select Job
Case "GET Job1"
' If HttpUtils.IsSuccess(ImageUrl) Then
' Dim b As Bitmap
' b = HttpUtils.GetBitmap(ImageUrl)
' Activity.SetBackgroundImage(b)
' End If
' 'Start the second GET job
' HttpUtils.DownloadList("GET Job2", Job2Links)
Case "GET Job2"
Dim i As Int
'For i = 0 To HttpUtils.Tasks.Size - 1
'link = HttpUtils.Tasks.Get(i)
'If(HttpUtils.IsSuccess(link))Then
'If(Job2Links.IndexOf(link)<>-1) Then
'
'
'Job2Links.RemoveAt(Job2Links.IndexOf(link))
'
'Log( "##REMOVED" & link)
'End If
'End If
'
'Next
' For i = 0 To HttpUtils.Tasks.Size - 1
' link = HttpUtils.Tasks.Get(i)
' Log(link & ": success=" & HttpUtils.IsSuccess(link))
' Next
' If HttpUtils.IsSuccess("http://www.google.com") Then
' Log(HttpUtils.GetString("http://www.google.com"))
' End If
Case "POST Job1"
' If HttpUtils.IsSuccess(PostUrl) Then
' Log(HttpUtils.GetString("http://www.b4x.com/print.php"))
' End If
' 'Start the first GET job.
' HttpUtils.Download("GET Job1", ImageUrl) 'start
End Select
Job.Release
End Sub
Sub WaitFor(Milliseconds As Int)
Dim s As Long
s = DateTime.Now
Do While DateTime.Now < s + Milliseconds
Loop
End Sub
:sign0104:
:sign0144: