How to use your own plugin in ionic

6

I am trying to use a socket connected by TCP in my Ionic 3 application.

To do this I follow the following steps:

1- I create an ionic application:

  

ionic start testTcp blank --cordova

2- I enter the directory of the application

  

cd testTcp

3- Install ionic-native (when I create the project I think it already includes it but I still install it again)

  

npm install ionic-native --save

4- I download the following plugin to install it from local instead of installing it from the repository, the downloaded plugin is the following: link

5- I install the plugin in my application:

  

ionic cordova plugin add cordova-plugin-chrome-apps-sockets-tcp-master

So far everything goes well, if I look at the plugins I have installed with the following command: ionic cordova plugin ls tells me that I have installed the plugin "cordova-plugin -..." which is the one I just installed.

The problem comes when using this plugin, when creating a socket and connecting to a host.

How do I use this plugin? Do I have to make an import in the home.ts file? What would this import be like?

Being a plugin of my own, I do not see how to do it and I can not find documentation.

I tried the plugman tool but it does not even let me install the plugin.

    
asked by Pablo Simon DiEstefano 26.03.2018 в 12:16
source

1 answer

1

You have access to it from any component of the application through the objecto windows

ngOnInit() {
    (<any>window).chrome.sockets.tcp.create({}, () => {
        console.log('funcionado!');
    });
}
    
answered by 12.04.2018 / 13:29
source