I got a weird issue. My application is able to fetch everything from server when it is installed on Android version 5.0. However, the app cannot fetch anything from server when it is installed on Android version 4.4.
My server is using PHP code. My application is using React native code.
Here is the network code in my application which copied from React native network :
function getMoviesFromApiAsync() {
return fetch('https://facebook.github.io/react-native/movies.json')
.then((response) => response.json())
.then((responseJson) => {
return responseJson.movies;
})
.catch((error) => {
console.error(error);
});
}
When I replace the URL by my own one, the fetch function throws an error Network request fail
even my real android device has strong network connection.
Here is my testing environment:
If there is any solution to make the api request work for Android version 4.4, please let me know.
Thank you in advance!
Thank you all, I found these links:
Why Android 4.x to fetch API - missing TLS
Actually, because Android 4.x has TLS 1.1 and 1.2 inside but not enabled, we cannot make a request to a server which has TLS 1.1 or 1.2. We need to enable them first in order to do that
Thank you again for all the comments. I really appreciate it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.