FAQ Database Discussion Community


Find available wifi connections in Android

android,networking,android-wifi
I am trying to create a help wizard to recover from bad network connections in the app. One test case I hope to handle is the case where an end user has WiFi turned off, WiFi is available, and the mobile network is slower than the WiFi network. In this...

android wifi p2p : peers discovery filtering

android,android-wifi
I'm implementing the wifi p2P (direct wifi) in my android application, in order to share small files between clients. I'm following these pretty good tutorials: http://developer.android.com/guide/topics/connectivity/wifip2p.html http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html I can now discover peers and connect to them. I'd like to know if there is a way to filter the discovered peers....

Android connect to Wifi programmatically if wifi name match

java,android,wifi,android-wifi,wifimanager
I would like to build an app, that checks all the available WiFi networks, If a network's SSID matches a search key then connect to that network, if two networks match then connect to the one with the higher signal strength. e.g. SearchKey = "Open"; here is the code to...

Detect age of network need for Google Maps Geolocation API

android,google-maps,google-maps-api-3,android-wifi,telephonymanager
I m creating an app using Google Maps Geolocation API that will get the location of user from Network. Google Maps Geolocation API have some attribute to send in url to get the proper output from Google. My Problem is Cell tower objects - age for reference yu can check...

How to stay connected through mobile network after WIFI is connected on Android?

android,android-wifi,android-networking,connectivity
I noticed that while streaming audio from a remote server through 3G (mobile) connection and while the WIFI is disconnected or OFF, as soon as WIFI is activated and connected, connection through 3G is dropped. I want the app keep using 3G even if WIFI is connected too now. I...

Android location from wifi only

android,gps,location,android-wifi
I've a custom HW running Android 4.4.4. It has a wifi connection but no GPS or cellular modules. I need to determine the location based on wifi only, but it seems Android can't. Visiting google.com in the browser also shows 'unknown' location. The wifi works ok though - browsing internet...

Android - check internet and Wi-Fi connectivity with the help of BroadcastReceiver?

java,android,android-intent,android-wifi,android-broadcast
I want to check internet and Wi-Fi connectivity. I have implemented the code. But in this code the problem is, when I activate Wi-Fi in my device then it continuously toasts "Wi-Fi disconnected" and "Internet Connected" 3-4 times and then at last times it toasts "Wi-Fi connected" and then my...

Getting the IP Address of an Android Device using it's hotspot from another android device

android,android-wifi
I have two android enabled devices.On one device i turned on the hotspot and from other device i am connecting to that hotspot. Now i want to get the IP address of the first device. How can i get it. Because i want to send a file to the first...

issues with one to many mobile device file transfer in android using wifi direct

android,android-wifi,wifi-direct,wifip2p,android-wireless
I am trying to create an app where one android app can transfer files ( text , video , photo ) to other multiple android devices.initially i thought to use wifi direct in android to share files across multiple devices. but the problem i am facing with WiFi direct is...

Code work when wifi off and 3G on but not when wifioff and 4G

android,android-wifi,network-protocols
what i have done is i am playing stream in wifi and 3g is also on. I disabled the wifi, stream stops but restart immidately cause 3g is enable. But problem starts when wifi and 4g is on, that time its not working i added listener like IntentFilter intentFilter =...

How to recognize when WiFi is not connected due to wrong password?

android,android-wifi,wifimanager,wificonfiguration
I've already made app that scans WiFi aps in a list and connects to a selected ap. But I still don't get what is returned if I put wrong password. Does WifiManager (or WifiConfiguration) returns something if I put wrong password? ...

Accessing WiFi LAN (no gateway) and mobile network simultaneously

android,ios,network-programming,windows-phone,android-wifi
I'm aware it's been asked before (with limited or no solution) but I haven't seen any recent updates and I think my scenario is unique so I'll start a new thread. I have a Raspberry Pi and it's functioning as a hot spot among other things. By design, DHCP isn't...

How to detect that you are in the building using some Google /Location API on Android

android,geolocation,google-places-api,android-wifi,android-location
I need to detect when I enter into building from the street. Now I use the next: if your device are connected to the wifi - you are into the building. I use WifiManager.NETWORK_STATE_CHANGED_ACTION for that. But this is not entirely accurate, because there are many free zone wi-fi, in...

Start Android Wifi Settings - restricted

android,android-intent,settings,android-wifi
Is there a way to open the Android Wifi Settings and restrict access to just wifi settings? Intent intent = new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK); startActivity(intent); The above will open the android settings to the wifi fragment, but the user can touch the Setting button in the upper left corner and then have...

How to implement wifi direct like a super beam?

android,android-wifi,wifi-direct,wifimanager,wifip2p
I want to implement Wifi direct as follows: From Device: Enabling Wifi Direct Generate Wifi direct id using barcode scanner Receiver needs to scan the barcode and connect to "To Device" and transfer data from "From Device" Can you suggest how to get wifi direct id in barcodescanner later which...

Android WiFi Direct - client/server - ECONNREFUSED (Connection refused) UPDATE

java,android,client-server,android-wifi,wifi-direct
I have a problem with my Android client/server app. I would like to connect devices by WiFi Direct and send through some media files. I made an Activity and Service for both Client and Server. Code is below. ServerActivity: import java.util.ArrayList; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import...

Check for WPS support in code

android,android-wifi,wifimanager
I see that WifiManager has tools to initiate a WPS connection with a Wi-Fi network, but I see nothing that could actually check if WPS is available or not. So, how to check if the current Wi-Fi network supports WPS?...

Getting Wrong Network Interface in android?

android,android-wifi
I have update my mobile to Android Lollipop, before updating to Lollipop it works fine. Now I am facing problem with network interface. if (isWifiConnected()) { Log.d(TAG,"Wifi is connected"); mNetIf = Utils.getActiveNetworkInterface(); String name = mNetIf.getName(); Log.d(TAG, "network interface in constructor" + NetworkInterface.getByName(name)); //do some multicast Operations. } If the...

Android - check internet, wifi and GPRS status with the help of ConnectivityManager?

java,android,android-intent,android-wifi,android-internet
I have read that the "ConnectivityManager" class gives information about the network. But I am confused on how to implement the code. I need an efficient way to check internet, wifi and GPRS at a time. Thanks

Using Wifi WPS automation in app

android,wifi,android-wifi,router,wps
I'm working on a home project and im trying to open my network programmatically! Is there any way to simulate pressing the WPS button from an app? My aim is to write an app where on a click of a button it would simulate pressing the WPS key on my...

Get user country by using Wi-Fi

android,android-wifi,android-location
I am looking for a way to get the user's country by using the Wi-Fi. So far I have managed to do it using TelephonyManager and the SIM card, like this TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); String s = telephonyManager.getSimCountryIso(); This works ok, but the problem is, the user may...

wifi scan is not performed when calling wifi.startScan() outside the MainActivity

android,android-wifi
I'm working on an application which loads a map ( as an image). I'm using a customized view to load the image. I have to perform a wifi scan and store the results whenever the user touches the map. I have declared the wifi manager this way: public static WifiManager...

Using Service to carry out operation - asynchronous tasks

android,android-wifi,android-library
I have a bound service which I have setup in a Library module which I have created. My issue would be simple if this was not a library module, as I need things to be dynamic for others. The current app uses the library module to search and create connections...

MotoG 5.0.2 has wifi issues

android-5.0-lollipop,android-wifi,wifimanager
I have updated my MotoG to Android 5.0.2. But since then, I have been facing WiFi issues. My device does not detect the available wifi's. Some Wifi's, work when I change the channel, on my router. But these issues is not observed on my friends MotoG who has also upgraded...

Wakelock and wifilock not working

java,android,android-wifi,wakelock
I have read plenty of tutorial and posts here on SO regarding the use of WakeLock and WifiLock, but still didn't get to a solution of my issue. I'm writing an app that has, when you start it, the only effect of creating and starting a (foreground) service. This service...

Can I connect to ad-hoc wifi network on Android while hosting another ad-hoc network?

android,networking,android-wifi,wifi-direct
I need to dynamically construct network of interconnected Android devices. I have seen previous question in topic which says it's impossible: Android Wifi direct multiple connection ad-hoc However, Android documentation says that since Android 4.0 it is possible to make an ad-hoc connection: http://developer.android.com/guide/topics/connectivity/wifip2p.html I would love to check it...

Android - Passing simple string over Wi-fi?

java,android,android-wifi,android-broadcast,android-file
I have Wi-fi direct demo. In that we can transfer any image files to other devices. When another device get connected and it shows to send image from gallery. And at other side it shows sent image. But I want to send a simple string and at other side I...