'cordova not defined?'

Hi all,
I’m currently trying to use the pushPlugin plugin, however when i try to initialize it, it says that ‘cordova’ is not defined. The cordova.js file is being included, however it 404s like it’s supposed to. If that’s the case, how are plugins like these supposed to work? More specifically, how would is get pushPlugin to work?

Hi, I am facing the same issue. Did you get a solution?

Are you trying to test from the device / simulator or web browser.

Most ngCordova plugins will not work in a web browser because they use native device code. This is one possible reason. Another possible reason is that you are trying to use a plugin that depends on the device being ready. If you try to use the plugin before it is ready, you will get an error.

Without seeing any code, I can’t really advise.

Regards,

Thanks @nicraboy for reply. I was testing on emulator. The problem was with the JS loading structure. A script tag wasn’t closed above cordova.js causing a four day long trouble. :smile:

BTW. your blogs on ionic are really cool !

Hey quick note on that stuff too! A GREAT way to keep in browser and emulator compatibility while testing, is if you wrap those functions in a try and catch block, the web view will basically skip over them as if they don’t exist. It’s great for notifications, the media plugin, and more.

Here’s an example of me hiding the splash screen, but it only sets on the actual device since if it throws an error the code just skips over it if i’m in the simulator or web view:

try {
    navigator.splashscreen.hide();
}catch(e) {

}

Hi.
I am building Ionic apps but i have critical issue with BadgeNumber for Appicon.
I used NgCordova and used below codes
$cordovaBadge.hasPermission().then(function(result) {
$cordovaBadge.set(3);
}, function(error) {
console.log(“error”);
});
It’s not working. Please help me !!!