0
如何在Tizen中執行網關檢查?或者有什麼方法可以知道使用Javascript的默認路由器的IP地址?使用Javascript進行網關檢查
如何在Tizen中執行網關檢查?或者有什麼方法可以知道使用Javascript的默認路由器的IP地址?使用Javascript進行網關檢查
在你的問題中,你需要一個JavaScript解決方案。但你已經將這個問題標記爲Tizen本地人。除非你正在製作混合應用程序,否則通常意味着排除其他應用程序。如果您正在使用JavaScript,以下是答案。
聽起來像你會有興趣SystemInfoWifiNetwork。它有以下界面。
interface SystemInfoWifiNetwork : SystemInfoProperty {
readonly attribute DOMString status;
readonly attribute DOMString ssid;
readonly attribute DOMString ipAddress;
readonly attribute DOMString ipv6Address;
readonly attribute DOMString macAddress;
readonly attribute double signalStrength;
readonly attribute SystemInfoWifiSecurityMode securityMode;
readonly attribute SystemInfoWifiEncryptionType encryptionType;
readonly attribute SystemInfoNetworkIpMode ipMode;
readonly attribute DOMString subnetMask;
readonly attribute DOMString gateway;
readonly attribute DOMString dns;
};
網關持有您要求的信息。但要注意的一點是,爲了保持電量,如果手機在周圍,手錶可能會關閉WiFi。
已經有一個代碼示例用於在Tizen開發者網站上檢索這些信息。看看https://developer.tizen.org/community/tip-tech/system-information-api-guide
function onSuccessCallback(wifi) {
alert("Status: " + wifi.status + " SSID: " + wifi.ssid
+ "\nIP Address: " + wifi.ipAddress + "\nIPV6 Address: " +
wifi.ipv6Address + " Signal Strength: " + wifi.signalStrength);
}
function onErrorCallback(error) {
alert("Not supported: " + error.message);
}
tizen.systeminfo.getPropertyValue("WIFI_NETWORK", onSuccessCallback, onErrorCallback);
你試圖解決你的問題的方式是什麼?請在此分享。 –