Hi,
I am developing an application with capactior and ionic/angular (latest version), and I am facing the following problem:
From the browser I retrieve data correctly from a proprietary API, but from the APK compiled and installed on a device it does not retrieve anything.
The API has the following header, as I saw that it could be a CORS issue, without them it doesn’t work either:
- header(‘Access-Control-Allow-Origin: *’);
- header(‘Content-Type: application/json’);
- header(“Access-Control-Allow-Methods: GET, POST, OPTIONS”);
- header(“Access-Control-Allow-Credentials: false”);
From the device if I access the URL of the API also works, I am importing the following packages:
- import { HttpClient } from ‘@angular/common/http’;
- import { Injectable } from ‘@angular/core’;
And return the result:
getAlertas() {
const url = 'http://myurl.api.com';
const params = {};
return this.http.get(url, params);
}
And the view is a simple list with *ngFor=let articulo of articulos | async
Greetings,