WorkManager NetworkType.CONNECTED not working behind Great Firewall of China

956 views Asked by At

We have an android 8.1 device running in China. The device needs to upload photos for archiving to a server when connected to the internet. Following Google's recommendations, this is implemented with WorkManager and an 'UploadPhotoWorker'. On the WorkRequest, we've set the Network.CONNECTED constraint and no others. This works on newer Android devices within China, but not on the Android 8.1 device.

On closer inspection of the device in question, the Wifi always shows 'Connected, but no internet access.' However, the device is otherwise able to download and interact with the server, so this is message is inaccurate. I've found mention that Wifi connections in China usually show this because Google.com is inaccessible behind the great firewall. It seems that this is being used to inform work manager of whether the network is available. Are there any suggestions on a workaround for this problem? If we remove the constraint entirely, the device would keep attempting uploads even without a connection. I don't see any way to override the connection check done by WorkManager.

0

There are 0 answers