[英]Why cordova is not defined?
I try build project android from IONIC. 我尝试从IONIC构建项目android。 I want make app running in background and I use cordova-plugin-background-mode but after include some code show error message in debugger.
我想让应用程序在后台运行,我使用cordova-plugin-background-mode,但是在调试器中包含一些代码后显示错误消息。 Error message like this
cordova is not defined
. 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. 我不知道为什么未定义cordova。 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. 如果您在浏览器上运行项目,则会收到此错误,因为Cordova需要在设备或模拟器上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.