I am encountering an issue with my TypeScript Ionic code. It works well in browsers and some older mobile devices, but it fails to function on newer Android versions like 8+. I need assistance in resolving this problem.
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);
}
}