Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Phonegap连接类型返回null_Android_Jquery_Eclipse_Cordova - Fatal编程技术网

Android Phonegap连接类型返回null

Android Phonegap连接类型返回null,android,jquery,eclipse,cordova,Android,Jquery,Eclipse,Cordova,我想获取设备的连接类型,但脚本每次都返回null function verificaconexiunea(){ var conexiune = navigator.connection.type; alert(conexiune); var status={}; status["Connection.UNKNOWN"] = 'Conexiune necunoscuta

我想获取设备的连接类型,但脚本每次都返回null

function verificaconexiunea(){
                var conexiune = navigator.connection.type;
                alert(conexiune);
                var status={};
                status["Connection.UNKNOWN"]  = 'Conexiune necunoscuta';
                status["Connection.ETHERNET"] = 'Conexiune Ethernet';
                status["Connection.WIFI"]     = 'Conexiune WiFi';
                status["Connection.CELL_2G"]  = 'Conexiune Internet 2G';
                status["Connection.CELL_3G"]  = 'Conexiune Internet 3G';
                status["Connection.CELL_4G"]  = 'Conexiune Internet 4G';
                status["Connection.NONE"]     = 'Fara conexiune internet!';
}
变量“conexiune”始终返回0。
有人能帮我吗?

什么版本的Cordova?你是否在等待DeviceRady事件触发?

显然是DeviceRady事件触发,因为,我是这么说的,那个警报(conexiune);显示“0”。我使用cordova 3.0.0.Hmm,好吧,我想这很明显,但我想确定一下。那么-你添加了连接插件了吗?请记住,在Cordova 3中,每个功能都必须作为插件添加。是的。。我在config.xml中添加了插件,因为plugins.xml不存在。但仍然存在同样的问题。除非您使用PhoneGap构建,否则在config.xml中添加它是不够好的。你是吗?如果你在本地构建,你也需要添加插件。是的。我正在使用phonegap构建。如何添加插件?