[Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

Marian Beermann public at enkore.de
Sat Sep 26 18:46:39 CEST 2020


An interface like this is inherently racy. QNCM (obsolete) may tell you
you are online, you connect to the server, send your stuff, and while
that happens the device goes offline and you get an error. You probably
handle this case already.

Stuff like this is "informational" and you can't assume stuff will work,
because the API said you're online. Conversely, your servers might be
reachable even if it says the device is "offline". (What does "internet
connectivity" mean, after all? It's pretty hard to define...)

I second Thiago's suggestion - just keep trying quietly in the
background, don't rely on "device is online" indicators (either in Qt,
or in other frameworks/APIs).

If you only have a "heavy" API endpoint to use, I'd ask the backend
developers to add a lightweight "status" API endpoint you can use to
check if you can reach the server without necessarily doing any hard work.

Cheers, Marian

Am 26.09.20 um 17:53 schrieb ekke:
> Am 26.09.20 um 17:39 schrieb Thiago Macieira:
>> On Friday, 25 September 2020 23:58:26 PDT Alexander Dyagilev wrote:
>>> Hello,
>>>
>>> Tested with Qt 5.12.9. Any workarounds?
>> Suggestion: stop trying to check and assume that you are online.
>>
> imagine a mobile app for outpatient services, where a nurse visits
> patients and at each patient has to confirm services done and to send
> vital values and so on...
> 
> while on tour and visiting the patients the device sometimes is online,
> sometimes offline
> 
> all service items done are written to a queue. queue watches online
> state and always when the device is online items waiting in the queue
> are sent to server
> 
> in the evening when all work is done user can only log out if all work
> is sent to server - if not online he/she gets an info "you're not online
> - work items cannot be sent" ...
> 
> assuming that the device is online won't work in such kind of use-cases,
> pulling also is no good idea
> 
> (have some more mobile apps where it's also important always to know the
> online state)
> 
> ekke
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list