【问题标题】:Intel XDK + Phonegap英特尔 XDK + Phonegap
【发布时间】:2014-05-02 04:16:39
【问题描述】:

想问一下,我是否可以将英特尔 XDK API 和 Phonegap API 集成到一个移动应用程序中? 这是因为,某些 API 仅在 Phonegap 中可用,反之亦然。

【问题讨论】:

    标签: cordova intel-xdk


    【解决方案1】:

    是的,如果我正确理解了这个问题,我相信您可以使用英特尔 XDK 在单个应用程序中访问这两个 API。

    【讨论】:

    • 这是正确的,您可以在应用程序中同时使用 intel.xdk API 和 Cordova API 并构建,在您的应用程序中包含 intelxdk.js 和 cordova.js。
    • 您的意思是,我需要下载cordova.js,然后将其包含在我的应用程序中吗?太棒了..谢谢
    • 不只是添加脚本标签<script src="cordova.js"></script>
    【解决方案2】:

    当您在 XDK 上构建新的空白项目时,可以在 index.html 中找到这些提示:

    注意:不要在 intelxdk.js 或 cordova.js 中使用目录前缀 - 它们会自动插入 由构建系统、模拟器和其他工具生成,并假定位于 index.html 源目录中。 您不会在项目的任何地方找到这些 JS 文件,它们是“幻像”库。如果你看到 作为项目一部分的这些文件的副本应将其删除以避免混淆 XDK。

    When building with any of the XDK Cordova build systems (e.g., "Cordova Hybrid App") you can
    omit the "intelxdk.js" and "xhr.js" script files shown below. It does not hurt to keep them, but
    they are not used in that environment, they are only needed for the "legacy" XDK build systems.
    (In the case of the Cordova build system, the Cordova and XDK apis are included as plugins
    and the CORS configuration is specified as a parameter in the build configuration file.)
    

    所以答案是肯定的,你可以同时使用,而且你可能会注意到一些 API,如 AccelerometerGeolocationBase API 已被弃用,英特尔建议使用 Cordova API 来代替使用这些功能。

    注意:

    您将找不到 intelxdk.jscordova.js 的源文件,因为您可以看到它们是 Phantom 文件,自动插入到您的脚本中,因此您不应该为这两个脚本添加任何额外的源,如果您愿意的话删除任何两个来源,只需删除 index.html 中的相应行:

    <script src="intelxdk.js"></script>         <!-- phantom library, needed for XDK api calls -->
    <script src="cordova.js"></script>          <!-- phantom library, needed for Cordova api calls -->
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多