android-wifi

Broadcast intents for bluetooth, wifi and ringer mode

笑着哭i 提交于 2020-01-01 05:37:05
问题 What are the intents that are broadcasted in the following events, Wifi state change Bluetooth state change Ringer mode change 回答1: For Wifi state changes: WifiManager.WIFI_STATE_CHANGED_ACTION ("android.net.wifi.WIFI_STATE_CHANGED") Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown. One extra provides this state as an int. Another extra provides the previous state, if available. WifiManager.NETWORK_STATE_CHANGED_ACTION ("android.net

Can I have both Wi-Fi and cellular network interfaces open at the same time on Android?

筅森魡賤 提交于 2020-01-01 02:00:07
问题 I'm working on an application that will run on a phone where the phone will be a station on a private Wi-Fi network. The phone will be a station, not an access point, and the private Wi-Fi network does not route to the Internet. My application needs to communicate with servers on the Internet as well as devices on the local Wi-Fi network, so it needs to have connections on both networks at the same time. I've been trying to figure out how to do this. I've been trying the technique described

how to obtain the ip address of the connected wifi router in android programmatically?

感情迁移 提交于 2020-01-01 00:44:11
问题 I want to obtain the ip address of the the wifi router to which my android phone is connected? I know that we can get the mac/BSSId and SSID by using the android APIS but I don't find the way to find the way to find the ip address of it? I found the code for obtaining the ip address of phone owns wifi router WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo myWifiInfo = myWifiManager.getConnectionInfo(); int ipAddress = myWifiInfo.getIpAddress(); System.out

Android - Correct way to detect disconnecting from a particular wifi ssid?

爷,独闯天下 提交于 2020-01-01 00:22:30
问题 I've seen a couple of BroadcastReciever examples to detect wifi disconnects but none of them seem to work correctly (triggering twice for each disconnect for example) and none mention checking against an ssid, is this even possible? So just to clarify, I want to detect disconnection from a particular ssid. An actual disconnect and not wifi being disabled on the device. Thanks EDIT: Re-opening as nothing works on both the devices we have to test. 回答1: NETWORK_STATE_CHANGED_ACTION was the

Android - force network requests go through wifi instead of mobile network

时光毁灭记忆、已成空白 提交于 2019-12-31 03:10:44
问题 I have an app which connects to a hardware device Wi-Fi hotspot. It seems that Android forward requests over other networks (3G/4G for example) instead the hotspot, since my hot spot has no internet connection. Is there any way to force network stream to work on the wifi? I've come across the following function, but it's deprecated: https://developer.android.com/reference/android/net/ConnectivityManager.html#setNetworkPreference(int) 回答1: Per the Connecting your App to a Wi-Fi Device blog

How to know the positioning mode is WIFI or 2G/3G cell tower in Android?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 05:22:09
问题 We know there are two positioning mode in Android: GPS and network. If we use network, then Android can use WIFI or 2G/3G cell tower to position. Without GPS, we can simply use LocationManager.NETWORK_PROVIDER to get the location data. But how can we know the mode is WIFI or 2G/3G cell tower exactly? Android doesn't provide separate providers for WIFI and cell tower. I have thought a method. But I am not sure whether it is correct. Please review and give comments: Check whether I can get a

How to get the coarse location using Wifi or GSM or GPS, whichever is available?

有些话、适合烂在心里 提交于 2019-12-29 04:03:06
问题 My app only needs a coarse location service when started up. In detail, I need the app's rough location so as to provide the users with the shop info nearby. The location does NOT need to be updated constantly. In addition, coarse localization will be sufficient in this case. I wish the app to choose GSM, or wifi, or GPS automatically, whichever is available. The location service should also be one-time to save phone energy . How may I do that? I have tried using GPS separately. My problem is

How to get the coarse location using Wifi or GSM or GPS, whichever is available?

流过昼夜 提交于 2019-12-29 04:03:06
问题 My app only needs a coarse location service when started up. In detail, I need the app's rough location so as to provide the users with the shop info nearby. The location does NOT need to be updated constantly. In addition, coarse localization will be sufficient in this case. I wish the app to choose GSM, or wifi, or GPS automatically, whichever is available. The location service should also be one-time to save phone energy . How may I do that? I have tried using GPS separately. My problem is

Adb over wireless without usb cable at all for not rooted phones [duplicate]

China☆狼群 提交于 2019-12-28 08:06:36
问题 This question already has answers here : How can I connect to Android with ADB over TCP? (34 answers) Closed last year . I want to debug Android APPs on my phone (LG nexus 4). I'm travelling and I forgot my USB cable. When I work at home I can do it just connecting the USB cable and executing the command 'adb tcpip 5555'. Then I can unplug the USB cable and connect via 'adb connect IP'. But now I cannot execute the first command because I don't have a cable. I don't understand why I have to

How to get name of wifi-network out of android using android API?

无人久伴 提交于 2019-12-27 11:56:27
问题 I thought that I should use NetworkInterface::getDisplayName. I got some name, but this name is different that this name which I can see, when I choosing to which network I want to connect. Please help.. [EDIT] acording to Loxley answer: WifiManager wifiMgr = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); String name = wifiInfo.getSSID(); 回答1: android.net.wifi.WifiInfo.getSSID ? 回答2: public String getWifiName(Context