Ionic4 Angular7 Capacitor HttpCLient @angular/common/http

Hello everybody, I would really apreciate some help. I am using the HttpClient ( import {HttpClient} from ''@angular/common/http'; ). I can log data and error returned when subscribing to httpClient.get for instance if the project is launched on a browser. But when I launch my project for android on a Samsung galaxy s8 + no logs get returned. It looks like if subscription was ignored. I am using Angular7, Ionic4 and Capacitor, here is the sample code used:

import {HttpClient} from '@angular/common/http';

doTest() {
    console.log('Test'); // <-- Logging on both browser and Android
      data => console.log(data), // <-- Logging only in browser
      error => console.log(error), //  <-- Logging only in browser
1 Like

Hi @cengiz74 :wave:

Maybe your requests are being rejected by CORS. Can you get any error log from the device using the Chrome device inspector at chrome://inspect and plugging your phone via USB?

You can find more information about CORS in the documentation:


1 Like

Thank you very much it works :slight_smile:

1 Like