未找到Phonegap背景地理位置插件 [英] Phonegap background geolocation plugin not found

查看:268
本文介绍了未找到Phonegap背景地理位置插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找解决方案来解决我的问题,我一直在寻找回购问题,stackoverflow和更多,没有找到解决方案:



我安装了背景地理位置插件og phonegap,因为它在这里解释: https://github.com/christocracy/科尔多瓦 - 插件 - 背景地理位置
当收到deviceready事件时,我尝试在其中执行代码示例,但遇到了一些问题:首先,找不到 window.navigator.geolocation ,我不得不将它替换为 navigator.geolocation 以获取第一个地理位置调用。

  • 然后,找不到window.plugins.backgroundGeoLocation对象,它总是返回null。



  • 我尝试了这里解释的解决方案: https:// github.com/christocracy/cordova-plugin-background-geolocation/issues/202 (在plugins / org.transistorsoft.cordova.background-geolocation / plugins.xml中替换),但没有结果仍为空。



    当我尝试控制window.plugins对象时,它只会返回我 {insomnia:{}}

    我很困惑,我不知道如何让你的羽毛杜松子酒对象,以便在手机处于睡眠状态时获得地理定位功能(使用标准凝胶定位插件时没有问题,但我需要它在后台运行以防用户按手机的睡眠按钮)。



    我的phonegap版本:5.1.1-0.29.0

    我的cordova版本:5.1.1



    感谢您的提前解答!



    注意:我试图用失眠插件阻止睡眠模式,以便让GPS点捕捉运行。它可以工作,除非你按下手机的睡眠按钮,这会关掉所有的东西,直到我们唤醒手机。
    如果你有任何诀窍可以完成这项工作,那么我就可以了!



    NB2:在Android下进行测试后,它似乎有效。当手机睡着时(在按下睡眠按钮后),我继续ping网址。但在我的iPhone上,当我按下睡眠按钮时,ping停止,当我唤醒手机时重新开始工作。

    看来phonegap新的渲染系统不允许访问移动原生功能。事实上,我明白它只呈现视图(HTML + CSS + JS)。本地cordova geolocation的工具是可访问的,因为它们使用导航器,但我们不能使用其他插件使用本机代码。


    $ b

    仅供参考,这是我使用的手机版本: http://app.phonegap.com/
    这似乎是非常有限和限制性的,所以,我建议你直接使用cordova,如果你有这种类型的需求。



    有关更多详细信息,您可以按照我在repo打开的问题:
    https://github.com/christocracy/cordova-plugin-background-地理定位/问题/ 203

    I am looking for a solution to my problem and I've been searching in the repo issues, stackoverflow and more, without finding a solution :

    I installed the background geolocation plugin og phonegap as it is explained here : https://github.com/christocracy/cordova-plugin-background-geolocation. When deviceready event is received, I try to execute your code example in it but I encountered a few problems :

    • first, window.navigator.geolocation was not found, I had to replace it by navigator.geolocation to get the first geolocation call.
    • then, the window.plugins.backgroundGeoLocation object is not found too, it is always returns null.

    I tried with the solution explained here : https://github.com/christocracy/cordova-plugin-background-geolocation/issues/202 (replacing by in the plugins/org.transistorsoft.cordova.background-geolocation/plugins.xml) but without the result is still null.

    When I try to console the window.plugins object, it only returns me { insomnia: {} }.

    I am quite confused, I don't know how to get your plugin object in order to get the geolocation working in background when the phone is asleep (I had no problem using the standard gelocation plugin but I need it to run in background in case the user press the sleep button of his phone).

    My version of phonegap : 5.1.1-0.29.0
    My version of cordova : 5.1.1

    Thank you by advance for your answers !

    NB : I tried to prevent sleeping mode with the insomnia plugin, in order to let the gps points capture running. It works, unless you press the sleep button of the phone, which is turning everything off until we awake the phone.. If you have any trick to do the job, I'm taking it !

    NB2 : It seems to work after a test under Android. I continue to ping an URL while the phone is asleep (after pressing the sleep button). But on my iPhone, the ping stop when I press the sleep button and it restarts to work when I wake the phone.

    解决方案

    It seems that phonegap new render system doesn't permit to access to mobile native functionalities. In fact I understood that it renders only views (HTML + CSS + JS). Tools as native cordova geolocation are accessible because they use the navigator but we can't use other plugins using native code.

    FYI, this is the version of phonegap I used : http://app.phonegap.com/ It seems to be very limited and restrictive, so, I suggest that you use directly cordova if you have this type of needs.

    For more details, you can follow the issue I opened on the repo here : https://github.com/christocracy/cordova-plugin-background-geolocation/issues/203

    这篇关于未找到Phonegap背景地理位置插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆