php - Why my ionic app does not show data from the DB in Android?
one text
I have a simple Ionic app that shows some data from a PHP service. The PHP connects to the database and returns a JSON.
This is the code of the service (in the url, instead of "MyIP" is written my real IP):
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class ApiserviceService {
apiURLCarreras = 'http://MyIP/vaspa/servicioPlanes.php';
constructor(private http:HttpClient) { }
getCarreras(){
return this.http.get(`${this.apiURLCarreras}`);
}
}
This works great in my PC! I can see the list of items: list of items in PC
But in my Android device, when I run the app I can??t see any item. The list is empty.
However, if I put the URL of the service (MyIP/vaspa/servicioPlanes.php) in the web browser, I can see the JSON with all the items: list of items Android web browser
I have Windows 10 with Xampp 7.2.32 (configured to support external connections) The Android device is a Xiaomi Redmi Note 6 Pro.
Any clues what is happening? What is the mistake? I think might be a problem from the smartphone but I don't have another in this moment.
Source