开发学院手机开发Android 开发 Android WiFi 电源管理 阅读

Android WiFi 电源管理

 2010-03-12 15:37:00 来源:WEB开发网   
核心提示:mContext.getSystemService(Context.POWER_SERVICE);mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);mWakeLock.setReferenceCounte
mContext.getSystemService(Context.POWER_SERVICE);

mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);

mWakeLock.setReferenceCounted(true);

// Create a wifi lock

WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);

mWifiLock = wifiManager.createWifiLock(WIFILOCK_KEY);

mWifiLock.setReferenceCounted(true);

}

private void acquire(){

// Acquire wake lock

mWakeLock.acquire();

// Acquire wifi lock

mWifiLock.acquire();

}

private void release(){

// Release wifi lock

mWifiLock.release();

// Release wake lock

mWakeLock.release();

}

}

上一页  1 2 3 

Tags:Android WiFi 电源

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接