本文整理汇总了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;
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}