Problem with ionic-native/serial and live reload


#1

Hey !
I encounter a bit of an issue here, I’m currently trying to develop an android app reading from a usb serial device, and it seems to work for now.
But using the live-reload feature of Ionic CLI seems to break the plugin. Everything works on the first run of the app, but when it reloads after making code changes, the plugin methods throws error with this message : “plugin_not_installed”. Everything seems right to me, and since I don’t see much user experiences on the web with this plugin, I’m asking for help here :slight_smile:

Thanks for you help !

My package.json

{
 "name": "testApp",
 "version": "0.0.1",
 "author": "Ionic Framework",
 "homepage": "http://ionicframework.com/",
 "private": true,
 "scripts": {
   "clean": "ionic-app-scripts clean",
   "build": "ionic-app-scripts build",
   "lint": "ionic-app-scripts lint",
   "ionic:build": "ionic-app-scripts build",
   "ionic:serve": "ionic-app-scripts serve"
 },
 "dependencies": {
   "@angular/common": "5.0.0",
   "@angular/compiler": "5.0.0",
   "@angular/compiler-cli": "5.0.0",
   "@angular/core": "5.0.0",
   "@angular/forms": "5.0.0",
   "@angular/http": "5.0.0",
   "@angular/platform-browser": "5.0.0",
   "@angular/platform-browser-dynamic": "5.0.0",
   "@ionic-native/core": "4.3.3",
   "@ionic-native/serial": "^4.3.3",
   "@ionic-native/splash-screen": "4.3.3",
   "@ionic-native/status-bar": "4.3.3",
   "@ionic/storage": "2.1.3",
   "cordova-android": "6.3.0",
   "cordova-plugin-device": "^1.1.4",
   "cordova-plugin-ionic-webview": "^1.1.16",
   "cordova-plugin-splashscreen": "^4.0.3",
   "cordova-plugin-whitelist": "^1.3.1",
   "cordovarduino": "0.0.8",
   "fr.drangies.cordova.serial": "~0.0.7",
   "ionic-angular": "3.9.2",
   "ionic-native": "^2.9.0",
   "ionic-plugin-keyboard": "~2.2.1",
   "ionicons": "3.0.0",
   "rxjs": "5.5.2",
   "sw-toolbox": "3.6.0",
   "zone.js": "0.8.18"
 },
 "devDependencies": {
   "@ionic/app-scripts": "3.1.0",
   "typescript": "2.4.2"
 },
 "description": "An Ionic project",
 "cordova": {
   "plugins": {
     "ionic-plugin-keyboard": {},
     "cordova-plugin-whitelist": {},
     "cordova-plugin-device": {},
     "cordova-plugin-splashscreen": {},
     "cordova-plugin-ionic-webview": {},
     "fr.drangies.cordova.serial": {}
   },
   "platforms": [
     "android"
   ]
 }
}

The page where I currently work

export class HomePage {

  public console: string = '';

  constructor(public navCtrl: NavController, private serial: Serial) { }

  ionViewDidLoad(){
    this.serial.requestPermission({
      vid:'2405',
      pid:'000b',
      driver: 'CdcAcmSerialDriver'
    }).then(() => {
      this.serial.open({
        baudRate: 9800,
        dataBits: 4,
        stopBits: 1,
        parity: 0,
        dtr: true,
        rts: true,
        sleepOnPause: false
      }).then(() => {
        this.console += 'Serial connection opened' + '\n';
        this.serial.registerReadCallback().subscribe(data => {
          this.console += JSON.stringify(data) + '\n';
        }, (error: any) => this.console += error + '\n');
      }).catch((error: any) => this.console += error + '\n' );
    }).catch((error: any) => this.console += error + '\n' );
 

  }

}


#2

Hi

I want to access hub ports using USB .like in android i find USB manager is there any way to do this in ionic