Caleb Lewis
Caleb Lewis

Reputation: 543

Cordova not defined?

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?

Upvotes: 0

Views: 744

Answers (2)

John Furneaux
John Furneaux

Reputation: 176

For most plugins, you're right. But the purpose of this plugin is to allow a device to receive a remote notification through one of the push providers (e.g. Apple's APN or Google' GCM).

For this plugin, there is no 'fake' provider which sends messages to a desktop computer, so it cannot set up a handler to listen for them.

I normally put code like this within an 'if window.cordova' conditional so that it doesn't run on desktop. You'll need to use a real device to test this plugin's functionality properly.

Hope that's useful,

John

Upvotes: 1

Raymond Camden
Raymond Camden

Reputation: 10857

If you are testing on the desktop, this is expected. They will not work there.

Upvotes: 0

Related Questions