android-wifi

Get my wifi ip address Android

纵然是瞬间 提交于 2019-11-26 19:49:08
How can I get the ip address of my phone when it is connected under wifi? I found a method here but it returns something like 24.182.239.255 even if I'm under wifi and I expect something like 192.168.1.10. I'd like something like: if (you are under wifi) String ip4 = getWifiIP() else String ip4 = getIPAddress with the method linked before Many thanks! If you would like to get the private IP address of your device when connected to Wi-Fi, you can try this. WifiManager wifiMgr = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); int ip = wifiInfo

Create Wifi Hotspot Configuration in android

为君一笑 提交于 2019-11-26 19:46:57
问题 I am using android 4.1.1 ... I am making an application that allows the user to make his own network using Wifi Hotspot and then the clients can connect to it and share data. I have successfully created the Wifi hotspot in android but I cannot configure it for the purpose. Is there any way to configure Wifi Hotspot on android through coding ?? 回答1: This answer maybe outdated! if(wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); } WifiConfiguration netConfig = new

Send request over Mobile data when WIFI is ON.(Android L)

萝らか妹 提交于 2019-11-26 18:59:24
问题 SDK: Android 5.0.1. Android build: LRX22C. Device : Nexus 5. Problem: KITKAT(4.4.4) and below API's 1) startUsingNetworkFeature(int networkType, String feature) This method is deprecated. Deprecated in favor of the cleaner requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback) . 2) requestRouteToHost(int networkType, int hostAddress) This method is deprecated. Deprecated in favor of the requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback) , setProcessDefaultNetwork

Can I find the MAC address of my Access point in Android?

故事扮演 提交于 2019-11-26 18:13:23
问题 Can my Android app find the MAC address of the Wifi access point it is connected to? The docs for android.net.wifi.WifiInfo getMacAddress() don't provide any details. See http://developer.android.com/reference/android/net/wifi/WifiInfo.html#getMacAddress(). I'm assuming this is the Mac address of my phone. Can I find the Mac address of the access point? 回答1: getBSSID() of WifiInfo class will return MAC address of remote access point. BSSID explained here. 回答2: The following method will return

how to Send string from Android to PC over wifi

浪子不回头ぞ 提交于 2019-11-26 17:58:17
问题 Hello i am working on an android app which requires to send a string over wifi to PC resulting in simulating keyboard keypresses.Any ideas how i can achieve this task ? 回答1: You would have to write a server program on the PC and use a ServerSocket to accept a connection from and write a thread for your Android phone that uses a regular socket (with the same port as the PC end) and then manage them using DataInputStream and DataOutputStream. You also need to open permissions on your

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

此生再无相见时 提交于 2019-11-26 17:24:13
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(); Loxley android.net.wifi.WifiInfo.getSSID ? sergey.n public String getWifiName(Context context) { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if

android: Determine security type of wifi networks in range (without connecting to them)

ぃ、小莉子 提交于 2019-11-26 16:17:31
I can enumerate all wifi networks in range (using startScan + SCAN_RESULTS_AVAILABLE_ACTION + getScanResults) and get their SSID and BSSID values, but I can't figure out how to determine the security type of each network. In my main object: IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); registerReceiver(scanReceiver, intentFilter); ((WifiManager)getSystemService(Context.WIFI_SERVICE)).startScan(); In my scanReceiver object: public void onReceive(Context c, Intent intent) { if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals

How users/developers can set the Android's proxy configuration for versions 2.x?

廉价感情. 提交于 2019-11-26 14:16:17
问题 I would like to know if it's possible for the user, or for the developers to set the Wi-Fi Access Point proxy settings in Android versions 2.x (I know that it's possible for 3.x or greater versions editing the AP configuration into the Wireless settings), in order to get the settings from code in the following way: ProxySelector defaultProxySelector = ProxySelector.getDefault(); List<Proxy> proxyList = defaultProxySelector.select("http://www.google.it"); (that should be the right way to get

SCAN_RESULTS_AVAILABLE_ACTION return empty list in Android 6.0

元气小坏坏 提交于 2019-11-26 13:06:28
Yesterday my Nexus 5 receive the update from Android MNC to version 6.0 - Marshmallow . Since then, the action to scan the networks available in the device stop receiving the list, in this case the result list have a size of 0, even with 10+ Wifi networks listed in the Wifi system settings. The code for this is the usual: Register the SCAN_RESULTS_AVAILABLE_ACTION and wait for the event in the Receiver, like this: // Register the Receiver in some part os fragment... getActivity().registerReceiver(wifiListener, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); WifiManager

Can I change the group owner in a persistent group in Wi-Fi Direct?

穿精又带淫゛_ 提交于 2019-11-26 11:08:04
问题 When creating a group via Wi-Fi Direct, I know that I can make a persistent group. My question is: can I create a persistent group, but each time change the group owner (i.e; each turn the group owner will be one of the devices in the group). Also, when creating a persistent group, it is required to accept the connection only the first time, right? 回答1: You can now create a new persistent group via WifiP2pManager.createGroup(..) . It will create a new group and make the calling device (A)