[英]Ionic cordova - Cors not working on newer version of android, But its working on android 7 or 6
I am having a problem with using typescript ionic, this is my code.我在使用 typescript 离子时遇到问题,这是我的代码。 its working fine in browser and some of mobile phones.它在浏览器和一些手机上运行良好。 but its not working on newer version of androids such as 8+ version.但它不适用于较新版本的机器人,例如 8+ 版本。 Please help me to fix this issue请帮我解决这个问题
import { Injectable } from '@angular/core';
import { HttpClient,HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { HTTP } from '@ionic-native/http/ngx';
import { Platform } from '@ionic/angular';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/timeout';
import {finalize} from 'rxjs/operators';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class AccessProviders{
server: string = 'http://example.com/api/';
constructor(
public http: HttpClient,
public nativeHttp: HTTP
){}
postData(body,file){
let type = "application/json; charset=UTF-8";
let headers = new HttpHeaders({ 'Content-Type': type });
let options = {
headers: headers
}
return this.http.post(this.server+file,JSON.stringify(body),options).map(res => res);
}
}
Please see the below link this may help.请参阅下面的链接,这可能会有所帮助。 as mentioned google has updated their policies.如前所述,谷歌已经更新了他们的政策。
https://medium.com/@mountainappstudio/api-not-running-on-android-oreo-8-0-or-higher-version-problem-solved-ded5cc614d5e https://medium.com/@mountainappstudio/api-not-running-on-android-oreo-8-0-or-higher-version-problem-solved-ded5cc614d5e
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.