Hi,
I have a scheduled task that downloads a web page (OkHttpUtils2) every morning. When the phone is "not asleep" it can download it, otherwise it gets an error message: java.net.UnknownHostException: Unable to resolve host.
Does anyone have any idea how to "wake up" the network ?
Thank you!
I have a scheduled task that downloads a web page (OkHttpUtils2) every morning. When the phone is "not asleep" it can download it, otherwise it gets an error message: java.net.UnknownHostException: Unable to resolve host.
The scheduler launcher::
StartReceiverAt(Reminder_receiver, nextTime, False)
I tried PhoneWakeState:
Public Sub loadWebPage
Dim job As HttpJob
Dim textReader As TextReader
Dim inputStream As InputStream
Dim webPage As String
Dim pws As PhoneWakeState
If startFromService = True Then
pws.KeepAlive(False)
'Sleep(500) not help
End If
job.Initialize("Download",Me)
job.Download(URL)
wait for (job) JobDone (job As HttpJob)
If job.Success Then
......
Else
logger.LogEvent("HTTP - No Internet: " & job.ErrorMessage)
StartReceiverAt(Reminder_receiver, DateTime.Now + DateTime.TicksPerHour * 1, False) 'rerun +1 hour
End If
End If
job.Release
If startFromService = True Then
pws.ReleaseKeepAlive()
End If
Does anyone have any idea how to "wake up" the network ?
Thank you!