Reputation: 431
I am working on a cordova android app. I am trying to implement push notifications. I tried so many ways using ngcordova, using normal plugin and some other methods all tries give me pushNotification undefined error. But the plugins are being installed without any error.
Then I followed this tutorial and did exactly the same, but it gives
device is not defined
error in the console. I used ripple emulator to test this. I installed it in the phone too, But the same error. I am using angularjs inside. and using cordova version 5.2.0. can anyone point me in a direction, I am really trying hard for the past 4 days but no luck. Please help me.
update
I have correct setup of angular and cordova I believe, because I already built an version of my app with the same setup and pc, and released it in play store. This problems arise only if I add some plugins like push, device, etc. In app browser and splash screen plugins are working fine though.
Upvotes: 0
Views: 404
Reputation: 424
Make sure to include cordova.js, but it need to be load after angular.js.
If you want, here's a working seed: https://github.com/marioaleogolsat/cordova-angular-angularMaterial-seed
Just remember that some plugins can't be used in a emulation, so use cordova run --device to make sure that anything is working properly.
Upvotes: 0
Reputation: 22483
If Cordova is undefined you probably don't have it referenced in your index page. make sure you have this line.
<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
Upvotes: 0
Reputation: 529
Hi It seems you have not done set up of Angular JS and Cordova properly. Before doing push notifications. You must be ready with Angular JS and Cordova setup.
See below link:
Follow above link and if it's done try to set up again push notifications.
Hope it helps you.
Upvotes: 0