I have some problems with the hotspot plugin. I use it on my HomePage directly and wanna connect to the wifi. but when i add the code to my home.ts I get a whitescreen. Can be that it is normal on Emulator, cause there is no wifi option, but I have the same problem, when i try it on my phone.
my home.html:
<ion-content padding="10px" class="startBackground">
<div class="homeContainer">
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-5"></div>
<div class="homeBox homeBox-4" align-items="center">
<img ion-img src="assets/imgs/startbuttontext.png" width="auto" align-items="center" (click)="navToPage('TabsPage')" (click)="connection('myssid', 'mypassword')>
</div>
<div class="homeBox homeBox-5"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-1"></div>
<div class="homeBox homeBox-2">Impressum</div>
<div class="homeBox homeBox-3"></div>
<div class="homeBox homeBox-6">
<img ion-img src="assets/imgs/akka_logo.png" width="90%" height=auto>
</div>
</div>
</ion-content>
and my home.ts:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Hotspot, HotspotNetwork } from '@ionic-native/hotspot'
import { ToastController } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html',
})
export class HomePage {
constructor(public navCtrl: NavController, public navParams: NavParams, public hotspot: Hotspot, public toastCtrl: ToastController) {
}
navToPage(pageName: string) {
pageName === 'TabsPage' ? this.navCtrl.setRoot(pageName) : this.navCtrl.push(pageName);
}
connect(ssid, password){
this.hotspot.connectToWifi(ssid, password).then( () => {
let toast = this.toastCtrl.create({
message: 'connected successfully',
duration: 3000,
position: 'top'
});
toast.present();
//connection to the WiFi network was successfull
})
.catch( () => {
let toast = this.toastCtrl.create({
message: 'connection failed',
duration: 3000,
position: 'top'
});
toast.present();
//connection to the WiFi network failed
});
}
}
the mistake has to be in the home.ts, cause its the same, when I delete the click option in home.html