简体   繁体   中英

Why cordova is not defined?

I try build project android from IONIC. I want make app running in background and I use cordova-plugin-background-mode but after include some code show error message in debugger. Error message like this cordova is not defined . I just include code like this

document.addEventListener('deviceready', function () {

}, false);
cordova.plugins.backgroundMode.enable();

I don't know why cordova is not defined. Please help me to solve this problem, Thanks

Question: are you running your project on a browser?

If you are running your project on a browser, you will get this error because Cordova needs to be run on a device or a simulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM