use of android.net.wifi.WifiManager in project FastDev4Android by jiangqqlmj.
the class StrUtils method getIpAddress.
// 获取用户的IPd
public static int getIpAddress() {
int ipAddress = 0;
WifiManager wifiManager = (WifiManager) FDApplication.getInstance().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo == null || wifiInfo.equals("")) {
return ipAddress;
} else {
ipAddress = wifiInfo.getIpAddress();
}
return ipAddress;
}
use of android.net.wifi.WifiManager in project PushSms by koush.
the class Helper method acquireTemporaryWakelocks.
public static void acquireTemporaryWakelocks(Context context, long timeout) {
if (wakeLock == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "PushSMS");
}
wakeLock.acquire(timeout);
if (wifiLock == null) {
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiLock = wm.createWifiLock("PushSMS");
}
wifiLock.acquire();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
wifiLock.release();
}
}, timeout);
}
use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class AssistTool method getWifiIp.
/**
* ��ȡ����wifi�����µ�ip��ַ
*
* @return
*/
public String getWifiIp() {
WifiManager wifiManager = (WifiManager) c.getSystemService(Context.WIFI_SERVICE);
int ip = wifiManager.getConnectionInfo().getIpAddress();
return intToIp(ip);
}
use of android.net.wifi.WifiManager in project Android-Terminal-Emulator by jackpal.
the class Term method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.v(TermDebug.LOG_TAG, "onCreate");
mPrivateAlias = new ComponentName(this, RemoteInterface.PRIVACT_ACTIVITY_ALIAS);
if (icicle == null)
onNewIntent(getIntent());
final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mSettings = new TermSettings(getResources(), mPrefs);
mPrefs.registerOnSharedPreferenceChangeListener(this);
Intent broadcast = new Intent(ACTION_PATH_BROADCAST);
if (AndroidCompat.SDK >= 12) {
broadcast.addFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
}
mPendingPathBroadcasts++;
sendOrderedBroadcast(broadcast, PERMISSION_PATH_BROADCAST, mPathReceiver, null, RESULT_OK, null, null);
broadcast = new Intent(broadcast);
broadcast.setAction(ACTION_PATH_PREPEND_BROADCAST);
mPendingPathBroadcasts++;
sendOrderedBroadcast(broadcast, PERMISSION_PATH_PREPEND_BROADCAST, mPathReceiver, null, RESULT_OK, null, null);
TSIntent = new Intent(this, TermService.class);
startService(TSIntent);
if (AndroidCompat.SDK >= 11) {
int actionBarMode = mSettings.actionBarMode();
mActionBarMode = actionBarMode;
if (AndroidCompat.V11ToV20) {
switch(actionBarMode) {
case TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE:
setTheme(R.style.Theme_Holo);
break;
case TermSettings.ACTION_BAR_MODE_HIDES:
setTheme(R.style.Theme_Holo_ActionBarOverlay);
break;
}
}
} else {
mActionBarMode = TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE;
}
setContentView(R.layout.term_activity);
mViewFlipper = (TermViewFlipper) findViewById(VIEW_FLIPPER);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TermDebug.LOG_TAG);
WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
int wifiLockMode = WifiManager.WIFI_MODE_FULL;
if (AndroidCompat.SDK >= 12) {
wifiLockMode = WIFI_MODE_FULL_HIGH_PERF;
}
mWifiLock = wm.createWifiLock(wifiLockMode, TermDebug.LOG_TAG);
ActionBarCompat actionBar = ActivityCompat.getActionBar(this);
if (actionBar != null) {
mActionBar = actionBar;
actionBar.setNavigationMode(ActionBarCompat.NAVIGATION_MODE_LIST);
actionBar.setDisplayOptions(0, ActionBarCompat.DISPLAY_SHOW_TITLE);
if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
actionBar.hide();
}
}
mHaveFullHwKeyboard = checkHaveFullHwKeyboard(getResources().getConfiguration());
updatePrefs();
mAlreadyStarted = true;
}
use of android.net.wifi.WifiManager in project FileExplorer by MiCode.
the class FTPServerService method takeWifiLock.
private void takeWifiLock() {
myLog.d("Taking wifi lock");
if (wifiLock == null) {
WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiLock = manager.createWifiLock("SwiFTP");
wifiLock.setReferenceCounted(false);
}
wifiLock.acquire();
}
Aggregations