{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ng-cordova/issues/1370","repository_url":"https://api.github.com/repos/driftyco/ng-cordova","labels_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/1370/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/1370/comments","events_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/1370/events","html_url":"https://github.com/driftyco/ng-cordova/issues/1370","id":185772479,"number":1370,"title":"Uncaught ReferenceError: PushNotification is not defined(…)","user":{"login":"stoconnor","id":4786068,"avatar_url":"https://avatars.githubusercontent.com/u/4786068?v=3","gravatar_id":"","url":"https://api.github.com/users/stoconnor","html_url":"https://github.com/stoconnor","followers_url":"https://api.github.com/users/stoconnor/followers","following_url":"https://api.github.com/users/stoconnor/following{/other_user}","gists_url":"https://api.github.com/users/stoconnor/gists{/gist_id}","starred_url":"https://api.github.com/users/stoconnor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoconnor/subscriptions","organizations_url":"https://api.github.com/users/stoconnor/orgs","repos_url":"https://api.github.com/users/stoconnor/repos","events_url":"https://api.github.com/users/stoconnor/events{/privacy}","received_events_url":"https://api.github.com/users/stoconnor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-27T20:31:20Z","updated_at":"2016-10-28T05:23:41Z","closed_at":null,"body":"At my wits end with $cordovaPushV5! Keep getting the following error:\r\n\r\nng-cordova.js:6378 Uncaught ReferenceError: PushNotification is not defined(…)\r\n\r\nProblem points to the following line:\r\n        push = PushNotification.init(options);\r\n\r\nUsing the latest Cordova CLI, ng-cordova. This through testing on the device and below is my code for initializing:\r\n\r\n \r\n```\r\n$ionicPlatform.ready(function() {\r\nlocalStorage.myPush = ; // I use a localStorage variable to persist the token\r\n\r\n        $cordovaPushV5.initialize(  // important to initialize with the multidevice structure !!\r\n            {\r\n                android: {\r\n                    senderID: \"XXXX\"\r\n                },\r\n                ios: {\r\n                    alert: 'true',\r\n                    badge: true,\r\n                    sound: 'true',\r\n                    clearBadge: true\r\n                },\r\n                windows: {}\r\n            }\r\n        ).then(function (result) {\r\n            $cordovaPushV5.onNotification();\r\n            $cordovaPushV5.onError();\r\n            $cordovaPushV5.register().then(function (resultreg) {\r\n                localStorage.myPush = resultreg;\r\n                console.log(resultreg)\r\n                var confirmPopup = $ionicPopup.alert({\r\n          title: 'Popup',\r\n          template: resultreg\r\n          });\r\n                // SEND THE TOKEN TO THE SERVER, best associated with your device id and user\r\n            }, function (err) {\r\n                // handle error\r\n            });\r\n        });\r\n```\r\n\r\n\r\nBeen at this for hours at this stage, my package.json file:\r\n```\r\n\"dependencies\": {\r\n    \"gulp\": \"^3.5.6\",\r\n    \"gulp-sass\": \"^2.0.4\",\r\n    \"gulp-concat\": \"^2.2.0\",\r\n    \"gulp-minify-css\": \"^0.3.0\",\r\n    \"gulp-rename\": \"^1.2.0\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"bower\": \"^1.3.3\",\r\n    \"gulp-util\": \"^2.2.14\",\r\n    \"shelljs\": \"^0.3.0\"\r\n  },\r\n  \"cordovaPlugins\": [\r\n    \"cordova-plugin-device\",\r\n    \"cordova-plugin-console\",\r\n    \"cordova-plugin-whitelist\",\r\n    \"cordova-plugin-splashscreen\",\r\n    \"cordova-plugin-statusbar\",\r\n    \"ionic-plugin-keyboard\",\r\n    \"cordova-plugin-inappbrowser\",\r\n    \"cordova-plugin-contacts\",\r\n    \"cordova-plugin-geolocation\",\r\n    \"phonegap-plugin-push\"\r\n  ],\r\n  \"cordovaPlatforms\": [\r\n    \"ios\",\r\n    \"android\"\r\n  ]\r\n}\r\n\r\n```\r\nHave the following in my config.xml also:\r\n```\r\n    <plugin name=\"phonegap-plugin-push\" spec=\"~1.8.3\">\r\n        <variable name=\"SENDER_ID\" value=\"XXXX\" />\r\n    </plugin>\r\n```\r\n\r\nI've even tried building a release version and installing it on the device to be 100% but to no avail. Is this an issue with ngCordova as the error suggests?"},"comment":{"url":"https://api.github.com/repos/driftyco/ng-cordova/issues/comments/256838964","html_url":"https://github.com/driftyco/ng-cordova/issues/1370#issuecomment-256838964","issue_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/1370","id":256838964,"user":{"login":"stoconnor","id":4786068,"avatar_url":"https://avatars.githubusercontent.com/u/4786068?v=3","gravatar_id":"","url":"https://api.github.com/users/stoconnor","html_url":"https://github.com/stoconnor","followers_url":"https://api.github.com/users/stoconnor/followers","following_url":"https://api.github.com/users/stoconnor/following{/other_user}","gists_url":"https://api.github.com/users/stoconnor/gists{/gist_id}","starred_url":"https://api.github.com/users/stoconnor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoconnor/subscriptions","organizations_url":"https://api.github.com/users/stoconnor/orgs","repos_url":"https://api.github.com/users/stoconnor/repos","events_url":"https://api.github.com/users/stoconnor/events{/privacy}","received_events_url":"https://api.github.com/users/stoconnor/received_events","type":"User","site_admin":false},"created_at":"2016-10-28T05:23:41Z","updated_at":"2016-10-28T05:23:41Z","body":"The other plugin gives me the same error. I'm running on a device and have even tried a signed release version to be sure.\r\n\r\nI'll try downgrading cordova to see if it makes a difference "}}
{"actor":{"display_login":"stoconnor"}}