本文整理匯總了Java中android.net.wifi.WifiManager.WIFI_MODE_FULL屬性的典型用法代碼示例。如果您正苦於以下問題:Java WifiManager.WIFI_MODE_FULL屬性的具體用法?Java WifiManager.WIFI_MODE_FULL怎麽用?Java WifiManager.WIFI_MODE_FULL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.net.wifi.WifiManager
的用法示例。
在下文中一共展示了WifiManager.WIFI_MODE_FULL屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: acquireResources
/**
* Ask to take the control of the wifi and the partial wake lock if
* configured
*/
private synchronized void acquireResources() {
if(holdResources) {
return;
}
// Add a wake lock for CPU if necessary
if (prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_PARTIAL_WAKE_LOCK)) {
PowerManager pman = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (wakeLock == null) {
wakeLock = pman.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "com.csipsimple.SipService");
wakeLock.setReferenceCounted(false);
}
// Extra check if set reference counted is false ???
if (!wakeLock.isHeld()) {
wakeLock.acquire();
}
}
// Add a lock for WIFI if necessary
WifiManager wman = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiLock == null) {
int mode = WifiManager.WIFI_MODE_FULL;
if(Compatibility.isCompatible(9) && prefsWrapper.getPreferenceBooleanValue(SipConfigManager.LOCK_WIFI_PERFS)) {
mode = 0x3; // WIFI_MODE_FULL_HIGH_PERF
}
wifiLock = wman.createWifiLock(mode, "com.csipsimple.SipService");
wifiLock.setReferenceCounted(false);
}
if (prefsWrapper.getPreferenceBooleanValue(SipConfigManager.LOCK_WIFI) && !wifiLock.isHeld()) {
WifiInfo winfo = wman.getConnectionInfo();
if (winfo != null) {
DetailedState dstate = WifiInfo.getDetailedStateOf(winfo.getSupplicantState());
// We assume that if obtaining ip addr, we are almost connected
// so can keep wifi lock
if (dstate == DetailedState.OBTAINING_IPADDR || dstate == DetailedState.CONNECTED) {
if (!wifiLock.isHeld()) {
wifiLock.acquire();
}
}
}
}
holdResources = true;
}
示例2: getWifiLockMode
@SuppressLint("InlinedApi")
private static int getWifiLockMode() {
return Util.SDK_INT < 12 ? WifiManager.WIFI_MODE_FULL : WifiManager.WIFI_MODE_FULL_HIGH_PERF;
}