Referencing the bencoding.network module
Ti.API.info("Create a new Carrier Info Object"); | |
var carrierInfo = benCodingNetwork.createCarrierInfo(); | |
Ti.API.info("Get carrier name => " + carrierInfo.carrierName); | |
Ti.API.info("Get mobile country code => " + carrierInfo.mobileCountryCode); | |
Ti.API.info("Get mobile network code => " + carrierInfo.mobileNetworkCode); | |
Ti.API.info("Get ISO country code for cellular service provider => " + carrierInfo.isoCountryCode); | |
Ti.API.info("Mobile service provider supports VOIP => " + carrierInfo.allowsVOIP); |
Ti.API.info("Create a new Reachability Object"); | |
var reachability = benCodingNetwork.createReachability(); | |
Ti.API.info("Get reachabilityWithHostName => " + reachability.reachabilityWithHostName("www.apple.com")); | |
Ti.API.info("Get reachabilityForLocalWiFi => " + reachability.reachabilityForLocalWiFi()); | |
var hostReachableByType = reachability.hostNameReachableBy("www.apple.com"); | |
function getReachableType(findType){ | |
var results = "Oops something went wrong"; | |
if(findType==reachability.NETWORK_STATUS_NOT_REACHABLE){ | |
results="Not Reachable"; | |
} | |
if(findType==reachability.NETWORK_STATUS_WIFI){ | |
results="WiFi Network"; | |
} | |
if(findType==reachability.NEWORK_STATUS_WWAN){ | |
results="Mobile Network"; | |
} | |
return results; | |
}; | |
var reachableType=getReachableType(hostReachableByType); | |
Ti.API.info("Reachable via => " + reachableType); |
This comment has been minimized.
This comment has been minimized.
same thing here. I recompiled it from the sources but the problem above is still there. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Hi Ben,
I tried to use function reachability.reachabilityWithHostName, but met below error, could you please advise?
Thank you very much.
Built with TiSDK 3.2.3.GA
[INFO] : Create a new Reachability Object
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at file:///Users/zhoujun/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/2994286B-E7DD-49D8-8523-A9AB23CB560F/Test.app/alloy.js:231";
[ERROR] : line = 133;
[ERROR] : message = "invalid method (createReachability) passed to BencodingNetworkModule";
[ERROR] : sourceId = 361180448;
[ERROR] : sourceURL = "file:///Users/zhoujun/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/2994286B-E7DD-49D8-8523-A9AB23CB560F/Test.app/alloy/controllers/index.js";
[ERROR] : }
[WARN] : Attempted to load BencodingNetworkReachabilityProxy: Could not find class definition.