Hi !
It seems to have an issue with connectivity detection and android kitkat (4.4.2)
I'm testing on a device with ethernet/wifi
When i start app with only ethernet enabled, download not starting.But when i connect wifi downloads start after some seconds.
Thanks for your support
I'm available if you need more tail
@tom42530 Are you able to try on a different kitkat devices? Are you only experiencing this issue on kitkat devices? What does you fetch configuration look like?
Sorry but i just have one type of device for kitkat and ethernet/wireless.Maybe i can try with virtual device but i don't no if ethernet can be simulate.I wil check. For my fetch config :
FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(ContentUpdateService.mApplication)
.setDownloadConcurrentLimit(3)
.enableLogging(true)
.enableAutoStart(true)
.enableHashCheck(true)
.build();
Thanks in advance
@tom42530 Your fetch configuration looks fine. It could just be that device. Try the simulator and let me know.
i just check on an kitkat emulator. wifi and ethernet simply does not exist in settings panel. it seems not possible
Isn't it related to https://github.com/square/okhttp/issues/4481?
sorry for the delay.perhaps. i need to do some test with local use of fetch. I mean not with gradle implementation "androidx.tonyodev.fetch2:xfetch2:3.1.0" but with a clone of sources and integrate it has module in my project but at the moment i have some issue to do that
ok i come back with some info.
seeems the problem is related to NetworkInfoProvider.kt l.129 (context.isNetworkAvailable())
in function isNetworkAvailable ,manager.activeNetworkInfo return null when im connected with ethernet
so i tried to setInternetAccessUrlCheck in fetchconfiguration and then in NetworkInfoProvider isNetworkAvailable use url open connection rather than context.isNetworkAvailable()
But it throw exception l126 (networkOnMainThreadException)
by modifying the function isNetworkAvailable with this return it seems working :
return manager.allNetworkInfo.any { n -> n.isConnected } (deprecated api 23)
@tom42530 I was able to pin point the network on main thread exception and will fix. also improved the isNetworkAvailable method. Will add to the next release
@tom42530 new version of fetch is now available with fixes. See readme and changelog.
@tonyofrancis thanks for your feedback. i will test your changes
Most helpful comment
@tom42530 I was able to pin point the network on main thread exception and will fix. also improved the isNetworkAvailable method. Will add to the next release