Advertisement
Guest User

Untitled

a guest
Jun 1st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import { Component, Injectable } from '@angular/core';
  2. import { NavController, AlertController, Platform } from 'ionic-angular';
  3. import { ProviderAccessApi } from './../../providers/provider-access-api';
  4. import {Network} from "ionic-native";
  5.  
  6. declare var navigator: any;
  7. declare var Connection: any;
  8.  
  9. @Component({
  10. selector: 'page-home',
  11. templateUrl: 'home.html',
  12. providers: [ProviderAccessApi]
  13. })
  14. export class HomePage {
  15. user : string;
  16. pass:string;
  17.  
  18. constructor(public navCtrl: NavController, public providerAPI:ProviderAccessApi, private platform: Platform, public alertCtrl : AlertController) {
  19. console.log('HomePage carragada com sucesso')
  20. this.platform.ready().then(() => {
  21. var networkState = navigator.connection.type;
  22. var states = {};
  23. states[Connection.UNKNOWN] = 'Unknown connection';
  24. states[Connection.ETHERNET] = 'Ethernet connection';
  25. states[Connection.WIFI] = 'WiFi connection';
  26. states[Connection.CELL_2G] = 'Cell 2G connection';
  27. states[Connection.CELL_3G] = 'Cell 3G connection';
  28. states[Connection.CELL_4G] = 'Cell 4G connection';
  29. states[Connection.CELL] = 'Cell generic connection';
  30. states[Connection.NONE] = 'No network connection';
  31. console.log(states[networkState]);
  32.  
  33. });
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement