#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim N As Notification
Dim hc As OkHttpClient
Dim testo As String
Dim timer1 As Timer
Dim timer2 As Timer
Dim risultatoA As String
Dim risultatoB As String
End Sub
Sub Service_Create
n.Initialize
n.Icon = "icon"
n.Sound = False
n.Vibrate = False
n.Light = False
n.OnGoingEvent=True
n.SetInfo("NUMERO", "txtmessagerx.text",Main)
n.Notify(1)
hc.Initialize("hc")
timer1.Initialize("timer1",4000)
timer2.Initialize("timer2",4000)
timer1.Enabled=True
timer2.Enabled=True
End Sub
Sub Service_Start (StartingIntent As Intent)
n.Notify(1)
Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
End Sub
Sub timer1_Tick
Log("sono sulla sub timer1 di Starter")
Dim job As HttpJob
job.Initialize("Job", Me)
job.Download("http://www.xxxx.xxx/xxxxx/xxxxx/NumeroA.txt")
End Sub
Sub timer2_Tick
Log("sono sulla sub timer2 di Starter")
Dim job As HttpJob
job.Initialize("Job", Me)
job.Download("http://www.xxxxx.xxxx/xxxx/xxxx/NumeroB.txt")
End Sub
Sub JobDone (job As HttpJob)
Log("JobName = " & job.JobName & ", Success = " & job.Success)
If job.Success = True Then
Select job.JobName
Case "Job" , "job2"
'print the result to the logs
testo =job.GetString
Log(job.GetString)
If testo.StartsWith("A") Then
Log("su starter nel job " & risultatoA)
If job.GetString = risultatoA Then
Log("minchiaaaaa minchia funziona!!!!")
StartActivity(avviso)
End If
else if testo.StartsWith("B") Then
If job.GetString = risultatoB Then
Log("minchiaaaaa funziona!!!!")
StartActivity(avviso)
End If
End If
Case "Job3"
'show the downloaded image
'Activity.SetBackgroundImage(job.GetBitmap)
End Select
Else
Log("Error: " & job.ErrorMessage)
'ToastMessageShow("Error: " & job.ErrorMessage, True)
End If
job.Release
End Sub
Sub testo_TextChanged (Old As String, New As String)
If testo = Old Then
Else
Log("vai sulla sub Creafile")
End If
End Sub
Sub Service_Destroy
n.Cancel(1)
End Sub