Does switching on wifi
enables wifi-direct
too?
If yes Then what is the need of this intent Wifip2pManager.WIFI_P2P_STATE_CHANGED_ACTION
?
If no Then how to enable or disable WIFI-DIRECT
?Any help would be greatly appreciated.
yes when you trun on your wifi Wifi-Direct facility also enables have a look at the below link for reference there you can get how you can play with this facility.
http://developer.android.com/guide/topics/connectivity/wifip2p.html
and if you want to check wether your wifi is on or of write below code
WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled()){
//wifi is enabled
}
also for details have a look at the below link it contain code for what you need just import it and run it.
https://android.googlesource.com/platform/development/+/master/samples/WiFiDirectDemo