I am happy to announce the first release of the TiNetworkHelpers project. This module provides support for Carrier information, SSID, BSSID, and Apple’s Reachability utility class.
Download the release – You can download the compiled release here. Before doing so, please read the “Getting Started” section below to make sure you have all dependencies.
Work with the code – to learn more about the project, and download the source please head over to the repo on github here.
Currently TiNetworkHelpers is only available on iOS, with Android support coming shortly.
Below is a full description of the project and the features available in the first release.
Before installing TiNetworkHelpers there are a few things you need to keep in mind.
- You need Titanium 1.8.1 or greater. I recommend downloading the CI build available here. When downloading please make sure you select the 1.8.X branch. For instructions on how to install a CI Build please read this article.
- This module has been tested only on iOS 5. There isn’t any iOS 5 specific features referenced, so it should work on iOS 4.3+.
- You can download a compiled release of TiNetworkHelpers here. If you need instructions on how to install a 3rd party module please read this.
- If you are building from source, you will want to modify the titanium.xcconfig file to match your installation directories.
Import the module
After installing the module you need to reference the TiNetworkHelpers module by using the following require command.
CarrierInfo provides access to the native CTTelephonyNetworkInfo framework object.
carrierName – Provides access to the carrier name associated with the device’s SIM.
mobileCountryCode – Provides access to the carrier Mobile Country Codes (MCCs). This is the country code associated with the carrier on the SIM. Here is a listing off all the Mobile Country Codes on wikipedia.
mobileNetworkCode – Provides access to the carrier’s Mobile Network Code. This is the network code associated with the carrier on the SIM. Here is a listing off all the Mobile Network Codes for the US on wikipedia.
isoCountryCode – The ISO country code for the user’s cellular service provider. This is the carrier on the SIM. Here is a listing of ISO codes on wikipedia
allowsVOIP – Indicates if the carrier allows VoIP calls to be made on its network.
CurrentNetwork provides access to the native CNCopyCurrentNetworkInfo object.
SSID – Provides access the SSID the device is currently connected.
BSSID – Provides access the BSSID the device is currently connected.
The Reachability component provides a wrapper for the Apple Reachability module. For more about Reachability please see the Apple documentation here.
reachabilityForLocalWiFi – This method provides a boolean result if Local Wifi is enabled.
reachabilityWithHostName – This method takes a host name, such as http://www.apple.com and returns a boolean result if the host is reachable.
hostNameReachableBy – This method takes a host name, such as http://www.benCoding.com and returns a constant with how it is reachable.