简体   繁体   English

奇怪的行为Cordova插件

[英]Strange behavior cordova plugin

I have a problem with a plugin for cordova 我的cordova插件有问题

When I use the plugin on android 4.4 it works perfectly but when I try it on android 4.2 it doesn't work the first time. 当我在android 4.4上使用该插件时,它可以完美地工作,但是当我在android 4.2上尝试它时,它第一次不起作用。 After reloading the application it works, on second reload stops working again. 重新加载应用程序后,它可以正常工作,在第二次重新加载后,它将再次停止工作。

The error is: 错误是:

      TypeError: Cannot read property 'backgroundGeoLocation' of undefined

Any ideas? 有任何想法吗?

Regards 问候

I had the same problem. 我有同样的问题。 It's just that the plugin isn't ready at this time. 只是这个插件还没有准备好。

Do not forget to put the initialization code in the onDeviceReady function! 不要忘记将初始化代码放在onDeviceReady函数中!

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    ... 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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