i need to develop android application for sending data from one client to another client via server. in this case server is android application which get data from one client and send to the selected client using Wi-Fi Direct.
Asked
Active
Viewed 407 times
-1
-
the purpose of WiFi Direct is to connect devices directly without a server. – eldjon Aug 20 '14 at 08:23
1 Answers
1
You can to check for both Wi-fi and Mobile internet as follows...
private boolean haveNetworkConnection() {
boolean haveConnectedWifi = false;
boolean haveConnectedMobile = false;
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
for (NetworkInfo ni : netInfo) {
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
if (ni.isConnected())
haveConnectedWifi = true;
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
if (ni.isConnected())
haveConnectedMobile = true;
}
return haveConnectedWifi || haveConnectedMobile;
}

joselufo
- 3,393
- 3
- 23
- 37
-
Using wifi direct it has to be connected without internet and wifi connection. because wifi direct has ability to create network using wifi Direct supported android device(mobile). – Raju Aug 20 '14 at 09:08