试图从build.phegap.com/plugins/414中添加模块。但是,在将<gap:plugin name="com.badrit.macaddress" version="0.1.0" />添加到config.xml,将try { window.MacAddress.getMacAddress( function(macAddress) {alert(macAddress);},function(fail) {alert(fail);} ); } catch {...添加到index.html之后,我收到了错误“类找不到”帮助我
index.html
<!DOCTYPE html>
<html>
<head>
<title>navigator.network.connection.type Example</title>
<script src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
checkConnection();
}
function checkConnection() {
alert('all ok');
try{
window.MacAddress.getMacAddress(
function(macAddress) {alert(macAddress);},function(fail) {alert(fail);}
);
} catch(e) {
alert(e.name)
} finally {
alert("finished")
}
}
</script>
</head>
<body>
<p></p>
</body>
</html>config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = ""
versionCode = "10"
version = "1.0.0" >
<preference name="phonegap-version" value="3.3.0" />
<!-- versionCode is optional and Android only -->
<name>PhoneGap Example</name>
<description>
An example for phonegap build docs.
</description>
<author href="https://build.phonegap.com" email="support@phonegap.com">
Hardeep Shoker
</author>
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.network-information" version="0.2.7" />
<gap:plugin name="com.badrit.macaddress" version="0.1.0" />
<gap:platform name="ios" />
<gap:platform name="android" />
</widget>发布于 2014-06-10 04:25:14
在index.html中,包括下面的插件脚本:
<script type="text/javascript" src="MacAddress.js"></script>发布于 2016-09-26 05:28:05
因为找不到MacAddress.js
您必须先找到路径文件夹MacAddress.js,
这是我从plugins\com-badrit-macaddress\www\MacAddress.js index.html获得的路径,包括这个文件--您需要访问的宏地址
https://stackoverflow.com/questions/24120621
复制相似问题