Android: Send data only by WIFI

I have a service that runs in background and send data to a server, I want to send this data only by wifi and not another way (gprs or else) is that possible? and if it is, how can I achieve that? if you have sample codes or links that would be great. thank you.

preguntado el 31 de julio de 12 a las 15:07

3 Respuestas

final ConnectivityManager connMgr = (ConnectivityManager)

final wifi =

The NetworkInfo structure should have the connectivity state of the Wifi Subsystem. Look at the documentation:

Use el isConnected method to see if wifi is connected. Easy Peasy!

Respondido 31 Jul 12, 15:07

networkinfo is deprecated then how we use this in above api 24 - adnan haider

Detectar el tipo de conexión de red en Android

This post might be what you're looking for, you can check to see if your app is connected to wifi before sending any data. Hope this helps

contestado el 23 de mayo de 17 a las 12:05

Respondido 31 Jul 12, 16:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.