当前位置: 首页>>代码示例>>Java>>正文


Java SystemUtils.isAndroidVersionOrLower方法代码示例

本文整理汇总了Java中org.andengine.util.system.SystemUtils.isAndroidVersionOrLower方法的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.isAndroidVersionOrLower方法的具体用法?Java SystemUtils.isAndroidVersionOrLower怎么用?Java SystemUtils.isAndroidVersionOrLower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.andengine.util.system.SystemUtils的用法示例。


在下文中一共展示了SystemUtils.isAndroidVersionOrLower方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isWifiHotspotSupported

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
/**
 * The check currently performed is not sufficient, as some carriers disabled this feature manually!
 */
public static boolean isWifiHotspotSupported(final Context pContext) {
	if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.ECLAIR_MR1)) {
		return false;
	} else {
		final WifiManager wifiManager = WifiUtils.getWifiManager(pContext);
		try {
			final Method WifiManager_isWifiApEnabled = wifiManager.getClass().getMethod("isWifiApEnabled");
			return WifiManager_isWifiApEnabled != null;
		} catch (final Throwable t) {
			return false;
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:17,代码来源:WifiUtils.java

示例2: getWifiHotspotIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
/**
 * @return prefers to return an IPv4 address if found, otherwise an IPv6 address.
 * @throws org.andengine.util.WifiUtils.WifiUtilsException
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getWifiHotspotIPAddressRaw() throws WifiUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final String networkInterfaceName = networkInterface.getName();

				if (ArrayUtils.contains(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES, networkInterfaceName)) {
					final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
					while (inetAddressEnumeration.hasMoreElements()) {
						final InetAddress inetAddress = inetAddressEnumeration.nextElement();
						if (!inetAddress.isLoopbackAddress()) {
							final byte[] ipAddress = inetAddress.getAddress();
							if (ipAddress.length == IPUtils.IPV4_LENGTH) {
								return ipAddress;
							} else {
								ipv6Address = ipAddress;
							}
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new WifiUtilsException("No IP bound to '" + Arrays.toString(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES) + "'!");
		}
	} catch (final SocketException e) {
		throw new WifiUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:42,代码来源:WifiUtils.java

示例3: getEmulatorIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getEmulatorIPAddressRaw() throws WifiUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
				while (inetAddressEnumeration.hasMoreElements()) {
					final InetAddress inetAddress = inetAddressEnumeration.nextElement();
					if (!inetAddress.isLoopbackAddress()) {
						final byte[] ipAddress = inetAddress.getAddress();
						if (ipAddress.length == IPUtils.IPV4_LENGTH) {
							return ipAddress;
						} else {
							ipv6Address = ipAddress;
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new WifiUtilsException("No IP found that is not bound to localhost!");
		}
	} catch (final SocketException e) {
		throw new WifiUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:34,代码来源:WifiUtils.java

示例4: getEthernetIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getEthernetIPAddressRaw() throws EthernetUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
				while (inetAddressEnumeration.hasMoreElements()) {
					final InetAddress inetAddress = inetAddressEnumeration.nextElement();

					if (!inetAddress.isLoopbackAddress()) {
						final byte[] ipAddress = inetAddress.getAddress();
						if (ipAddress.length == IPUtils.IPV4_LENGTH) {
							return ipAddress;
						} else {
							ipv6Address = ipAddress;
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new EthernetUtilsException("No ethernet IP found that is not bound to localhost!");
		}
	} catch (final SocketException e) {
		throw new EthernetUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:35,代码来源:EthernetUtils.java

示例5: checkCodePathSupport

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
private static void checkCodePathSupport() throws DeviceNotSupportedException {
	if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO)) {
		try {
			System.loadLibrary("andengine");
		} catch (final UnsatisfiedLinkError e) {
			throw new DeviceNotSupportedException(DeviceNotSupportedCause.CODEPATH_INCOMPLETE, e);
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:AndEngine.java

示例6: checkCodePathSupport

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
private static void checkCodePathSupport() throws DeviceNotSupportedException {
	if(SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO)) {
		try {
			System.loadLibrary("andengine");
		} catch (final UnsatisfiedLinkError e) {
			throw new DeviceNotSupportedException(DeviceNotSupportedCause.CODEPATH_INCOMPLETE, e);
		}
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:10,代码来源:AndEngine.java

示例7: getWifiHotspotIPAddressRaw

import org.andengine.util.system.SystemUtils; //导入方法依赖的package包/类
/**
 * @return prefers to return an IPv4 address if found, otherwise an IPv6 address.
 * @throws WifiUtilsException
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static byte[] getWifiHotspotIPAddressRaw() throws WifiUtilsException {
	try {
		byte[] ipv6Address = null;

		final Enumeration<NetworkInterface> networkInterfaceEnumeration = NetworkInterface.getNetworkInterfaces();
		while (networkInterfaceEnumeration.hasMoreElements()) {
			final NetworkInterface networkInterface = networkInterfaceEnumeration.nextElement();
			if (SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO) || !networkInterface.isLoopback()) {
				final String networkInterfaceName = networkInterface.getName();

				if (ArrayUtils.contains(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES, networkInterfaceName)) {
					final Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
					while (inetAddressEnumeration.hasMoreElements()) {
						final InetAddress inetAddress = inetAddressEnumeration.nextElement();
						if (!inetAddress.isLoopbackAddress()) {
							final byte[] ipAddress = inetAddress.getAddress();
							if (ipAddress.length == IPUtils.IPV4_LENGTH) {
								return ipAddress;
							} else {
								ipv6Address = ipAddress;
							}
						}
					}
				}
			}
		}

		if (ipv6Address != null) {
			return ipv6Address;
		} else {
			throw new WifiUtilsException("No IP bound to '" + Arrays.toString(WifiUtils.HOTSPOT_NETWORKINTERFACE_NAMES) + "'!");
		}
	} catch (final SocketException e) {
		throw new WifiUtilsException("Unexpected error!", e);
	}
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:42,代码来源:WifiUtils.java


注:本文中的org.andengine.util.system.SystemUtils.isAndroidVersionOrLower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。