Ionic View HTTP (native) plugin_not_installed

Hey there!
I’m am developing an application for my brother and I need to contact a remote server. For this, I’d like to use the native http plugin. Unfortunately, whatever I tried to make it work… didn’t work.
As you can see in the title, I get an error message in ionic view (“plugin_not_installed”).
First things first : (I’m developing with VS Code)

 ordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.1
Xcode version: Not installed

I’ve tried to recreate a new empty project with only the not-working code in it, and still not working.
Step I’ve followed:

  1. ionic plugin add cordova-plugin-http
  2. npm install --save @ionic-native/http
  3. Send to ionic view and test -> No crash (Would have been surprised)

  1. Add HTTP in the app.module

import { HTTP } from ‘@ionic-native/http’;

providers: [
StatusBar,
SplashScreen,
HTTP,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]

  1. Send to ionic view and test -> No crash

  1. Import HTTP and try to make a simple call in controller

import { Component } from ‘@angular/core’;

import { NavController } from ‘ionic-angular’;

import { HTTP } from ‘@ionic-native/http’;

@Component({
selector: ‘page-about’,
templateUrl: ‘about.html’
})
export class AboutPage {

private url: string = ‘https://myawesomeurl.com’;
private token: string = ‘myGr34tT0k3n’;

constructor(public navCtrl: NavController, public http: HTTP) {
this.getLastAttendance(‘NotMyBrothersName’, this.onLastAttendanceReceived);
}

onLastAttendanceReceived(data: any): void {
alert(data);
}

getLastAttendance(employee: string, callback: Function) : void {
let body = {token: this.token, employee : employee};
this.http.post(this.url + ‘attendances/last’, body, {})

      .then(response => {
        if (response.status == 200) {
          callback(response.data);
        }
        else {
          alert('Type de retour bizarre : ' + response.status);
        }
      })
      .catch(error => {
        alert('Une erreur s\'est produite : ' + error);
      });

}

}

  1. Send to ionic view and test -> CRASH : Plugin_not_installed

EDIT: It’s not a crash, it’s an alert and then the application works, but not the http call


Can anyone help me ? :slight_smile: Thanks you

Bump ? ^^‘
Seems that the question has fallen deep into the limbo ^^’

As far as I can see cordova-plugin-http is not part of Ionic View: https://docs.ionic.io/tools/view/#supported-plugins

Ionic View only includes a set list of plugins oyu can use. For all other plugins you have to build the app yourself. (You will need to build the app yourself anyway to be able to publish it, so just get it out of the way now. If you are missing the right hardware/OS, have a look at the Ionic Cloud Package service.)

1 Like

Oh… okay. Thank you !

I guess I’ll try with an android emulator then.

Good luck.

An aside: Why do you want to use cordova-plugin-http vs. Angular/JS functionality to call get files?

Later I will need to call my Rest API even when my brother is not using the app (in a service then)
to make push notifications according to what the server returns to my calls.

For what I’ve understood, this isn’t possible without the native plugin?

1 Like

Oh ok, I have no idea about services. Is this even possible with Cordova?