Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, Injectable } from '@angular/core';
- import { NavController, AlertController, Platform } from 'ionic-angular';
- import { ProviderAccessApi } from './../../providers/provider-access-api';
- import {Network} from "ionic-native";
- declare var navigator: any;
- declare var Connection: any;
- @Component({
- selector: 'page-home',
- templateUrl: 'home.html',
- providers: [ProviderAccessApi]
- })
- export class HomePage {
- user : string;
- pass:string;
- constructor(public navCtrl: NavController, public providerAPI:ProviderAccessApi, private platform: Platform, public alertCtrl : AlertController) {
- console.log('HomePage carragada com sucesso')
- this.platform.ready().then(() => {
- var networkState = navigator.connection.type;
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
- console.log(states[networkState]);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement