Skip to content

Instantly share code, notes, and snippets.

View maniaks's full-sized avatar

jmcg maniaks

  • Maniaks Interactive
  • Montpellier, France
View GitHub Profile
@welcoMattic
welcoMattic / IonicCordovaNetwork.js
Last active December 4, 2021 04:33
Async navigator.connection.type service for Ionic Framework
var myApp = angular.module('myApp').service('CordovaNetwork', ['$ionicPlatform', '$q', function($ionicPlatform, $q) {
// Get Cordova's global Connection object or emulate a smilar one
var Connection = window.Connection || {
"CELL" : "cellular",
"CELL_2G" : "2g",
"CELL_3G" : "3g",
"CELL_4G" : "4g",
"ETHERNET" : "ethernet",
"NONE" : "none",
"UNKNOWN" : "unknown",