Fetch: issue android 4.4.2 ethernet detection

Created on 5 Jun 2019  路  11Comments  路  Source: tonyofrancis/Fetch

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

bug enhancement help wanted

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

All 11 comments

@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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpvs0101 picture jpvs0101  路  6Comments

burhanaksendir picture burhanaksendir  路  3Comments

gbirk picture gbirk  路  5Comments

jpvs0101 picture jpvs0101  路  5Comments

MohammadFneish7 picture MohammadFneish7  路  4Comments