{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic/issues/9587","repository_url":"https://api.github.com/repos/driftyco/ionic","labels_url":"https://api.github.com/repos/driftyco/ionic/issues/9587/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic/issues/9587/comments","events_url":"https://api.github.com/repos/driftyco/ionic/issues/9587/events","html_url":"https://github.com/driftyco/ionic/issues/9587","id":194835230,"number":9587,"title":"Ionic v2 native plugin IBeacon doesn't work with cordova not defined error","user":{"login":"afgallo","id":9999415,"avatar_url":"https://avatars.githubusercontent.com/u/9999415?v=3","gravatar_id":"","url":"https://api.github.com/users/afgallo","html_url":"https://github.com/afgallo","followers_url":"https://api.github.com/users/afgallo/followers","following_url":"https://api.github.com/users/afgallo/following{/other_user}","gists_url":"https://api.github.com/users/afgallo/gists{/gist_id}","starred_url":"https://api.github.com/users/afgallo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afgallo/subscriptions","organizations_url":"https://api.github.com/users/afgallo/orgs","repos_url":"https://api.github.com/users/afgallo/repos","events_url":"https://api.github.com/users/afgallo/events{/privacy}","received_events_url":"https://api.github.com/users/afgallo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-11T14:38:45Z","updated_at":"2016-12-12T04:49:09Z","closed_at":null,"body":"**Ionic version:**  (check one with \"x\")\r\n[ ] **1.x**\r\n[x] **2.x**\r\n\r\n**I'm submitting a ...**  (check one with \"x\")\r\n[x] bug report\r\n[ ] feature request\r\n[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/\r\n\r\n**Current behavior:**\r\nFollowed this doc closely (https://ionicframework.com/docs/v2/native/ibeacon/) but the plugin doesn't work. I get erros saying **\"can't find cordova variable\"** or **\"cordova is not defined\"**. Note that this happens debugging in the browser, emulator and the actual device!\r\n\r\n**Expected behavior:**\r\nPlugin should work as per documentation.\r\n\r\n**Steps to reproduce:**\r\n\r\n1. npm install ionic-native --save\r\n2. ionic plugin add cordova-plugin-ibeacon\r\n3. ionic run ios -l -s -c --device\r\n\r\n**Related code:**\r\n\r\n```\r\nimport { Component } from '@angular/core';\r\nimport { NavController } from 'ionic-angular';\r\nimport { IBeacon } from 'ionic-native';\r\n\r\n@Component({\r\n    selector: 'page-logger',\r\n    templateUrl: 'logger.html'\r\n})\r\nexport class LoggerPage {\r\n    uuid: string = \"Loading ...\";\r\n\r\n    constructor(public navCtrl: NavController) {\r\n    }\r\n\r\n    ionViewDidLoad() {\r\n        const beaconRegion = IBeacon.BeaconRegion('demo', 'C96A588F-AE75-475A-8FF5-4CD72378728A');\r\n\r\n        // Request permission to use location on iOS\r\n        IBeacon.requestAlwaysAuthorization();\r\n        // create a new delegate and register it with the native layer\r\n        const delegate = IBeacon.Delegate();\r\n\r\n        IBeacon.startRangingBeaconsInRegion(beaconRegion).then(\r\n            () => console.log('Native layer recieved the request to ranging'),\r\n            error => console.error('Native layer failed to begin ranging: ', error)\r\n        );\r\n\r\n        delegate.didRangeBeaconsInRegion().subscribe(\r\n            data => {\r\n                console.log('didRangeBeaconsInRegion: ', data);\r\n            },\r\n            error => console.error()\r\n        );\r\n    }\r\n}\r\n```\r\n\r\n**Other information:**\r\n\r\n**Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below):\r\n\r\n```\r\nCordova CLI: 6.4.0\r\nIonic Framework Version: 2.0.0-rc.3\r\nIonic CLI Version: 2.1.13\r\nIonic App Lib Version: 2.1.7\r\nIonic App Scripts Version: 0.0.45\r\nios-deploy version: 1.9.0\r\nios-sim version: 5.0.12\r\nOS: macOS Sierra\r\nNode Version: v6.3.1\r\nXcode version: Xcode 8.1 Build version 8B62\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic/issues/comments/266342702","html_url":"https://github.com/driftyco/ionic/issues/9587#issuecomment-266342702","issue_url":"https://api.github.com/repos/driftyco/ionic/issues/9587","id":266342702,"user":{"login":"ghenry22","id":7463213,"avatar_url":"https://avatars.githubusercontent.com/u/7463213?v=3","gravatar_id":"","url":"https://api.github.com/users/ghenry22","html_url":"https://github.com/ghenry22","followers_url":"https://api.github.com/users/ghenry22/followers","following_url":"https://api.github.com/users/ghenry22/following{/other_user}","gists_url":"https://api.github.com/users/ghenry22/gists{/gist_id}","starred_url":"https://api.github.com/users/ghenry22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghenry22/subscriptions","organizations_url":"https://api.github.com/users/ghenry22/orgs","repos_url":"https://api.github.com/users/ghenry22/repos","events_url":"https://api.github.com/users/ghenry22/events{/privacy}","received_events_url":"https://api.github.com/users/ghenry22/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T04:49:09Z","updated_at":"2016-12-12T04:49:09Z","body":"//handle non-typed legacy plugin stuff\r\ndeclare var cordova: any;\r\ndeclare var window: any;\r\n\r\nput this just under your imports and try again"}}
{"actor":{"display_login":"ghenry22"}}