0

I don't know if its in native API or just my GS3. Wifi direct is automatically turned OFF after 5 minutes of inactivity. Is there is any way of keeping it on? or turn it On programmatically?

Thanks

ZeeShaN AbbAs
  • 1,365
  • 2
  • 15
  • 31
  • Maybe you are looking for this: http://stackoverflow.com/questions/14862018/startscan-has-result-after-10-min-when-phone-get-into-idle-state – laplasz Feb 16 '13 at 15:11

1 Answers1

0

You can use the Wi-Fi lock:

WifiLock wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE))
    .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock");

wifiLock.acquire();

When you no longer need the network, you should release the lock:

wifiLock.release();
Mark
  • 5,466
  • 3
  • 23
  • 24
  • I think you don't understand me I am talking about "Wifi Direct" which is added in android 4+ when I turn on the wifi direct I will automatically turned off after sometime – ZeeShaN AbbAs Oct 10 '12 at 12:03
  • Yeap sorry I tought you wanted to keep normal WiFi :) – Mark Oct 10 '12 at 13:31