Timeout ignored on Android devices
See original GitHub issueDescribe the bug Trying to send a request (no matter what) the timeout will be ignored and is alway 5000ms. The corresponding error gives the correct value in console e.g. “timeout of 30000ms exceeded” but it was actually 5000ms. On IOs everything is working fine. Try to set the timeout for default config and for each request. Same behavior.
const header = {
Authorization: myToken,
};
const defaultConfig = {
baseURL: url,
timeout: 30000,
headers: header,
};
return axios.create(defaultConfig);
Expected behavior The Timeout will be thrown after the defined timeout on Android devices
Environment:
- Axios Version [0.18.0]
- Android Version [9.0, 8.0]
- React Native Version [0.59.1]
Issue Analytics
- State:
- Created 4 years ago
- Reactions:22
- Comments:19 (1 by maintainers)
Top Results From Across the Web
Fix: Screen Timeout Not Working After Android 12 update
Fix: Screen Timeout Not Working After Android 12 update · Head over to the Settings menu on your device > Go to Apps...
Read more >Why screen timeout is not working? | Finddiffer.com
Method to Fix screen timeout not working after the Android 12 update. Try to clear the 'Settings' and 'Settings Services' app and then...
Read more >Android phone ignores screen timeout setting - help! | [H]ard
Reports of Android phones ignoring whatever their screen timeout setting ... Location of screen timeout setting: Settings / Display / Sleep
Read more >Axios timeout not working as expected on limited hotspot
Now if I place an HTTP using above axios configuration, it never times out after 30 seconds for Android devices. But for iOS...
Read more >Fix Screen Timeout Not Working After Android 12 update
Try to clear the 'Settings' and 'Settings Services' app and then reboot the device. Check for the issue again. For doing this: Go...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been forced to use cancelToken and a JavaScript timeout as a replacement to defaults.timeout which doesn’t work on all platforms. Here’s sample code for those who are still having this problem a year after it was reported:
I was experiencing the same problem on Android using RN. I solved the problem by adding:
in my AndroidManifest.xml
Seems like from Android 9 it blocks any call not in https. Here’s more info.