This project is read-only.

PhoneNetworking class

This class is used to determine the type of network a phone is currently using. It uses an enum to specify the different types of networking:


/// <summary>
/// Networking Types
/// </summary>
public enum NetworkType
{
  /// <summary>
  /// Unknown Network Type
  /// </summary>
  Unknown,
  /// <summary>
  /// No Network
  /// </summary>
  None,
  /// <summary>
  /// WiFi Connection
  /// </summary>
  WiFi,
  /// <summary>
  /// 3G or CDMA Connection
  /// </summary>
  Cellular,
  /// <summary>
  /// Ethernet via USB Connection
  /// </summary>
  Desktop
};

The use of the class is like so:


var type = PhoneNetworking.GetNetworkType();

switch (type)
{
  case PhoneNetworking.NetworkType.Desktop: return "Connected through USB";
  case PhoneNetworking.NetworkType.Cellular: return "Connected via Cell Reception";
  case PhoneNetworking.NetworkType.WiFi: return "Connected through WiFi";
  case PhoneNetworking.NetworkType.None: return "No Network Detected";
}

Last edited Mar 5, 2011 at 8:58 AM by TheADOGuy, version 3

Comments

No comments yet.