[英]Why request working on android simulator but not working on google play store app?
I have basic user login system datas come from http://www.birdpx.com/mobile/m_login (web site belongs to me) adress.我有来自http://www.birdpx.com/mobile/m_login (网站属于我)地址的基本用户登录系统数据。 But on similator requset working properly but it comes to app that downloaded google play store.但是在模拟器请求上正常工作,但它涉及下载谷歌播放商店的应用程序。 Request not working Here is my login codes?请求无效 这是我的登录代码? By the way everything works on app store correctly .顺便说一下,在应用商店中一切正常。 When submiting the codes (function) below work提交以下代码(功能)时
_handleSubmit=async (values)=>{
this.setState({
loading: true
})
const datam = { name: values.username, password: values.password };
const rest = await fetch('http://www.birdpx.com/mobile/m_login', {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-type': 'application/json' },
body: JSON.stringify(datam)
});
const gelenVeri = await rest.text();
let convertedVeri=JSON.parse(gelenVeri);
if (convertedVeri.status == 1) {
await this.setState({
userToken: 1
})
let giris = { token: this.state.userToken,user:convertedVeri.kullanici }
await AsyncStorage.setItem('isLoggedIn', JSON.stringify(giris));
const atama = await AsyncStorage.getItem('isLoggedIn');
const atamaVerisi = JSON.parse(atama);
if (atamaVerisi.token === 1) {
setTimeout(() => {
this.props.navigation.navigate('Home');
}, 2000)
} else {
this.setState({
loading: false
});
alert("Beklenmedik Bir Hata Oluştu");
}
} else {
this.setState({
loading: false
});
alert("Giriş Başarısız");
}
}
What do you think about that is that a problem about http/https issue and if it is how can , solve it?你怎么看这是一个关于http/https问题的问题,如果是,如何解决?
From Android 9 Pie now, requests without encryption(https) will never work.从现在的 Android 9 Pie 开始,没有加密(https)的请求将永远无法工作。 To enable requests to all types of connections HTTP and HTTPS in Android 9 Pie and above, use this attribute to your AndroidManifest.xml where you allow all http for all requests:要在 Android 9 Pie 及更高版本中启用对所有类型的 HTTP 和 HTTPS 连接的请求,请将此属性用于您的 AndroidManifest.xml,其中您允许所有请求的所有 http:
<application android:usesCleartextTraffic="true">
</application>
Source: https://developer.android.com/about/versions/pie/android-9.0-changes-28#tls-enabled来源: https : //developer.android.com/about/versions/pie/android-9.0-changes-28#tls-enabled
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.