M malcfreem Member Licensed User Longtime User Apr 16, 2014 #1 Hi. I have an app and, when it starts up, I want to check that there is an Internet connection (either wifi or 3g). I used Erel's suggestion of downloading a web page. I put the code into a new project and it worked fine. When I ported the exact same code into my app's code, it never calls JobDone. Is it maybe because of the threads? The library references are identical in both projects Here is a section of my code... Sub Process_Globals DimThread1AsThread'ignore => ignore warning of this line DimThread2AsThread'ignore => ignore warning of this line (etc) Sub Activity_Create(FirstTime AsBoolean) Dim job AsHttpJob job.Initialize("j", Me) job.Download("http://www.ladsbooks.co.uk/index.htm") spinnerMap.initialize Thread1.Initialise("Thread1") Thread2.Initialise("Thread2") File.Delete(File.DirInternal, "FDiOffers.db") ' only for testing 'check if the database already exists IfFile.Exists(File.DirInternal, "FDiOffers.db") = FalseThen 'if not, initialize it SQL1.Initialize(File.DirInternal, "FDiOffers.db", True) 'and create it CreateDataBase Else 'if yes, initialize it SQL1.Initialize(File.DirInternal, "FDiOffers.db", True) EndIf Timer1.Initialize("Timer1",4000) Timer2.Initialize("Timer2",300000) Timer3.Initialize("Timer3",60000) Timer1.Enabled=True Timer2.Enabled=False Timer3.Enabled=False Activity.RemoveAllViews svLay="BrowseRedeem" Activity.LoadLayout(svLay) End Sub Sub JobDone(job AsHttpJob) If job.Success Then Msgbox("Connection","Yes") Else Msgbox("No connection","No") EndIf job.Release End Sub
Hi. I have an app and, when it starts up, I want to check that there is an Internet connection (either wifi or 3g). I used Erel's suggestion of downloading a web page. I put the code into a new project and it worked fine. When I ported the exact same code into my app's code, it never calls JobDone. Is it maybe because of the threads? The library references are identical in both projects Here is a section of my code... Sub Process_Globals DimThread1AsThread'ignore => ignore warning of this line DimThread2AsThread'ignore => ignore warning of this line (etc) Sub Activity_Create(FirstTime AsBoolean) Dim job AsHttpJob job.Initialize("j", Me) job.Download("http://www.ladsbooks.co.uk/index.htm") spinnerMap.initialize Thread1.Initialise("Thread1") Thread2.Initialise("Thread2") File.Delete(File.DirInternal, "FDiOffers.db") ' only for testing 'check if the database already exists IfFile.Exists(File.DirInternal, "FDiOffers.db") = FalseThen 'if not, initialize it SQL1.Initialize(File.DirInternal, "FDiOffers.db", True) 'and create it CreateDataBase Else 'if yes, initialize it SQL1.Initialize(File.DirInternal, "FDiOffers.db", True) EndIf Timer1.Initialize("Timer1",4000) Timer2.Initialize("Timer2",300000) Timer3.Initialize("Timer3",60000) Timer1.Enabled=True Timer2.Enabled=False Timer3.Enabled=False Activity.RemoveAllViews svLay="BrowseRedeem" Activity.LoadLayout(svLay) End Sub Sub JobDone(job AsHttpJob) If job.Success Then Msgbox("Connection","Yes") Else Msgbox("No connection","No") EndIf job.Release End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 22, 2014 #21 The problem is with SntpTime I guess. This is not a http request. It cannot work with either HttpUtils2 or Http library. Upvote 0
The problem is with SntpTime I guess. This is not a http request. It cannot work with either HttpUtils2 or Http library.