Intel XDK与Phonegap的结合

4

想请问一下,能否在一个移动应用程序中集成Intel XDK API和Phonegap API?因为有些API仅在Phonegap中提供,反之亦然。

2个回答

6
是的,如果我理解问题正确,我认为您可以使用Intel XDK在单个应用程序中访问两个API。

没错,你可以在应用程序中同时使用intel.xdk API和Cordova API进行构建,只需在应用程序中包含intelxdk.js和cordova.js即可。 - krisrak
你的意思是我需要下载cordova.js然后将其包含在我的应用程序中吗?太棒了,谢谢。 - WenHao
1
不添加脚本标签<script src="cordova.js"></script> - krisrak

2

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

NOTE: do not use a directory prefix with intelxdk.js or cordova.js - they are inserted automatically by the build system, emulator and other tools and are assumed to be in the index.html source directory. You will not find these JS files anywhere in your project, they are "phantom" libraries. If you do see copies of these files as part of your project they should be removed to avoid confusing the 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。Intel建议使用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 -->

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接