I am having a problem with using typescript ionic, this is my code. its working fine in browser and some of mobile phones. but its not working on newer version of androids such as 8+ version. 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.