android-wifi

How to get the name of currently connected WiFi network in Android with BroadcastReceiver [duplicate]

送分小仙女□ 提交于 2019-12-06 04:37:31
问题 This question already has answers here : How to get name of wifi-network out of android using android API? (3 answers) Closed 6 years ago . In my implementation of BroadcastReceiver I want to run some Activity when user is connected to WiFi network with specific name. How can I do that? How can I get the Wifi network name in BroadcastReceiver? And how can I find out that this is wifi connection? Thank you! I already has a code: public class ConnectionChangeReceiver extends BroadcastReceiver {

How to remember wifi configuration and connected network through-out the reboots

你离开我真会死。 提交于 2019-12-06 03:56:13
问题 I am using following code to create new wifi access point and to connect to it. This code is working fine and i am able to connect to wifi access point, but the problem i am facing that is the wifi connection which i am creating is not getting remembered through out the reboots of the device. WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiConfiguration wc = new WifiConfiguration(); wc.SSID = "\"SSIDName\""; wc.preSharedKey = "\"password\""; wc.hiddenSSID = true;

Android - Get Notified when a new access point is detected?

China☆狼群 提交于 2019-12-06 01:24:41
Does Android provide a notification of being in vicinity of a new Wifi Network? Whether the device is configured to connect to that wifi network depends on whether the device has the wifi configuration set for that particular wifi network, but is it possible to get notification whenever entering any new wifi network? I saw the WifiManager class but the states inside the class do not seem to achieve what I am trying to do. Any ideas? Use a BroadcastReceiver registered to receive intents with action: WifiManager.NETWORK_STATE_CHANGED_ACTION . In this BroadcastReceiver, you can extract a

Is there a way to explicitly control WiFi scan intervals in Android?

爷,独闯天下 提交于 2019-12-05 20:22:34
问题 I am doing my Master thesis at the moment on WiFi positioning and in order to test my algorithms I needed to collect some data. To do this I have written a short and very simple program for Android which simply collects the RSSI for all availible access points found by each scan and saves them to file. I have set up a BroadcastReceiver that listens on the event WifiManager.SCAN_RESULTS_AVAILABLE_ACTION and I use a Timer , here called tim, to initiate scans with a WifiManager , called wifi as

WifiP2pManager return BUSY state on CreateGroup

巧了我就是萌 提交于 2019-12-05 19:15:39
问题 sometime when I try to create a group in WifiDirect it returns back WifiP2pManager.BUSY message as reason for failure. I am not sure why this happens. But if I restart the WIFI interface it will again work. What could be the possible reason for this? How this can be avoided? is there any way to overcome this if it ever happens? Thanks 回答1: In my case I was getting this error because I was not removing the group before trying to create it again. In that case the WifiManager is returning a BUSY

I want to get time from GSM network

♀尐吖头ヾ 提交于 2019-12-05 19:04:35
I am using this code but it gives time by wifi..when i turn off wifi,it is not giving me the time... I want to get the time from my GSM service provider... The code which I am using.. LocationManager locMan = (LocationManager) arg0.getSystemService(Context.LOCATION_SERVICE); long networkTS = locMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getTime(); Toast.makeText(arg0,""+networkTS,Toast.LENGTH_LONG ).show(); Date date = new Date(networkTS); SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("GMT+5:30")); String

Can I use WiFi to transfer data/messages between two android phones, not connected to a router?

倖福魔咒の 提交于 2019-12-05 17:19:07
I'm aware that if two Android phones are connected to a same wifi network, they can implement socket programming to transfer data between them But I actually want to know if you can use wifi as a transfer medium between two Android phones, just like you Bluetooth? With Android 2.2+ it is possible to create a WiFi hot-spot on one device so another device can connect. Internet connection on either device is not required. mpontillo What you are looking for is ad-hoc wireless networking , which is not well supported on the Android platform. (but some people have bravely rooted their phones and

How to detect whether device has 5Ghz Wi-Fi or not

跟風遠走 提交于 2019-12-05 17:16:34
I spent much time by seaching for solution but without result. So my question is, is there any way how to detect whether device has 5Ghz Wifi or not? It would be nice if it's possible to achieve that. I already analysed WifiManager but didn't find proper method or property. Thanks in advance. As of Android API Level 21, WifiManager has a method called is5GHzBandSupported() that returns true if the adapter supports 5 GHz band. Roc Boronat Our approach is to look for the results of a wifi scan and look for a signal of 5GHz. That's not a good solution, 'cause it would give false negatives, but if

Android network printers discovery: NullPointerException

女生的网名这么多〃 提交于 2019-12-05 16:48:15
This question does sound strange, but I never experienced this before. I'm working on network printer application and use NsdManager to discover printers in the WiFi network. It had been working fine for last two weeks, discovering and resolving printers in the same WiFi network. But all of a sudden I started getting the following exception every time I initiate discovery: 06-03 15:38:07.351: ERROR/AndroidRuntime(16849): FATAL EXCEPTION: NsdManager java.lang.NullPointerException at android.net.nsd.NsdManager$ServiceHandler.handleMessage(NsdManager.java:328) at android.os.Handler

Constructing a WifiConfiguration from a ScanResult or: Interpreting ScanResult's 'capabilities' String

拜拜、爱过 提交于 2019-12-05 16:37:17
问题 Do any of you Android gurus out there know of any open source code to create a WifiConfiguration from a given ScanResult? It would be helpful. Indeed, line 483 (/624) of my capture (mid April 2012) of the Android source of WifiConfiguration.java is a commented-out constructor intended to do exactly this, with a big TODO wondering whether it's worth implementing (see quote below). I motion yes, can I hear a second? The main challenge I see (which is actually the brunt of this question) is how