HTTP Request works on "Ionic serve" but not on phone


I have a quick and dirty app (started with the Ionic tabs template and directly coded on the home page) to check, if a picture is correct and accept or decline it. Not really special.
I send a request to a AWS Lambda function which returns me all the things I need.

And it works on “Ionic Serve”, like it should. But when I run it on my android phone with “ionic run android --device” the requests never have a response / never get fired or anything like this.

I have also implemented an additional button with a quick test. If I click it, I should get a response, but also no response.
Normally I always have an service interface, but for this application I don’t need it.

Can anyone think of any solution to solve this problem?

Here is my HTML code


<ion-content padding>

  <ion-refresher (ionRefresh)="doRefresh($event)">

  <h2>Snaps to check</h2>
  <button ion-button (click)="makeGetRequest()">GET Request</button>
  <div *ngFor="let snap of snaps">
<img [src]="snap.picUrl">
<button ion-button full (click)="send(true, snap)">
<button ion-button full (click)="send(false, snap)">

And here the Typescript code:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import * as io from '';
import { AlertController } from 'ionic-angular';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {
  socket: any;
  snaps: any[] = [];
  constructor(public navCtrl: NavController, public http: Http, public alertCtrl: AlertController) {
    //this.socket = io(""); //to listen

     this.http.get('').map(res => res.json()).subscribe(
      data => {
        this.snaps = data;
      err => {

   makeGetRequest() {
        .subscribe(data => {
            var alert = this.alertCtrl.create({
                title: "Your IP Address",
                subTitle: data.json().origin,
                buttons: ["close"]
        }, error => {

  send(allowed, snapobj) {
    if(allowed) {
      snapobj.allowed = true;
      //this.socket.emit('phoneRequest', snapobj);
      let index = this.snaps.indexOf(snapobj, 0);
      if (index > -1) {
        this.snaps.splice(index, 1);
    } else {
      snapobj.allowed = false;
      //this.socket.emit('phoneRequest', snapobj);
      let index = this.snaps.indexOf(snapobj, 0);
      if (index > -1) {
        this.snaps.splice(index, 1);


  doRefresh(refresher) {


Can anyone think of what I have done wrong? Why I don’t get any response on the phone?


nobody can help me?


Have you attached the chrome dev tools to the android device and checked the console?
There’s probably an error you’re missing


I’m sorry to ask but how can I attach them?
Is this something with remote debugging, chrome://inspect and so on.


I finally got the remote debugging.

can anybody help me with this? why can’t the device find my aws lambda? does anyone know?
and also an error:

polyfills.js:3 XHR finished loading: GET “”.
e @ polyfills.js:3
t.scheduleTask @ polyfills.js:3
e.scheduleMacroTask @ polyfills.js:3
(anonymous) @ polyfills.js:3
send @ VM43:3
(anonymous) @ main.js:54175
Observable.subscribe @ main.js:5497
Observable._subscribe @ main.js:5555 @ main.js:104470
Observable.subscribe @ main.js:5494
HomePage.ionViewDidLoad @ main.js:56198
HomePage.doRefresh @ main.js:56239
View_HomePage0.handleEvent_11 @ component.ngfactory.js:230
(anonymous) @ main.js:94123
schedulerFn @ main.js:34029
SafeSubscriber.__tryOrUnsub @ main.js:44122 @ main.js:44071
Subscriber._next @ main.js:44024 @ main.js:43988 @ main.js:19471
EventEmitter.emit @ main.js:34009
Refresher._beginRefresh @ main.js:41035
Refresher._onMoveInZone @ main.js:40997
(anonymous) @ main.js:40976
t.invoke @ polyfills.js:3
onInvoke @ main.js:34817
t.invoke @ polyfills.js:3 @ polyfills.js:3 @ main.js:34707
Refresher._onMove @ main.js:40975
main.js:56201 Response {_body: “”, status: 404, ok: false, statusText: “Not Found”, headers: Headers…}

will now try to fix it.
thanks for your help. will also help me in future :slight_smile: