PhoneGap 3.1 构建设备未定义 [英] PhoneGap 3.1 Build Device Is Not Defined

查看:20
本文介绍了PhoneGap 3.1 构建设备未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个煎茶触摸项目.我是用 phonegap 2.9 构建的并且工作正常 device.uuid 返回设备 ID.当我尝试使用 3.1 device.uuid 构建时,抛出未定义设备"错误.我的 config.xml

<preference name="stay-in-webview" value="true"/><access origin="*"/><gap:plugin name="com.phonegap.plugins.barcodescanner"/><gap:splash src="images/splash.png"/><功能名称="http://api.phonegap.com/1.0/camera"/><功能名称="设备"><param name="android-package" value="org.apache.cordova.device.Device"/></功能>

我的设备 ID 请求:

 试试{Ext.getCmp('txtUUID').setValue(device.uuid);}抓住(错误){警报(错误);Ext.getCmp('txtUUID').setValue('ID Okunamadı!');}

我需要帮助.如何解决这个问题?

解决方案

我假设您正在使用 phonegap build 进行构建,对吗?

在 phonegap 3 中,核心 api 不再默认包含,现在是插件,因此您必须明确添加您正在使用的任何 api.

将以下行添加到 config.xml 后,您应该能够读取 UUID:

您还可以删除以下几行,因为 API 功能现在由新的插件格式处理.

无用的行:

<功能名称="http://api.phonegap.com/1.0/camera"/><功能名称="设备"><param name="android-package" value="org.apache.cordova.device.Device"/></功能>

I have a sencha touch project. I was build with phonegap 2.9 and works fine device.uuid returning to device Id. When I tried the build with 3.1 device.uuid throwing " Device Is Not Defined" error. My config.xml

<preference name="phonegap-version" value="3.1.0" />
<preference name="stay-in-webview" value="true" />
<access origin="*" />

<gap:plugin name="com.phonegap.plugins.barcodescanner" />
<gap:splash src="images/splash.png" />

<feature name="http://api.phonegap.com/1.0/camera" />

<feature name="Device">
  <param name="android-package" value="org.apache.cordova.device.Device" />
</feature>

My Device ID request:

 try
{
   Ext.getCmp('txtUUID').setValue(device.uuid);
}
catch(err)
{alert(err);

    Ext.getCmp('txtUUID').setValue('ID Okunamadı!');

}

I need help. How to resolve this problem ?

解决方案

I assume you are building with phonegap build, right?

In phonegap 3, the core api are no more included by default and are now plugins, so you have to explicitly add any api you are using.

You should be able to read the UUID after adding the following line to config.xml :

<gap:plugin name="org.apache.cordova.device" />

And you can also remove the following lines since the API features are now handled by the new plugin format.

useless lines:

<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="Device">
  <param name="android-package" value="org.apache.cordova.device.Device" />
</feature>

这篇关于PhoneGap 3.1 构建设备未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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