android-wifi

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

删除回忆录丶 提交于 2019-11-27 04:18:24
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? Bill G You can now create a new persistent group via WifiP2pManager.createGroup(..) . It will create a new group and make the calling device (A) group owner and can do what you described. The only problem is once you create a group and connect to

Enabling WiFi on Android Emulator

最后都变了- 提交于 2019-11-27 03:36:51
How to enable WiFi on Android emulator? I have tried to find this but everyone is confusing WiFi with 3G. salman khalid Wifi is not available on the emulator if you are using below of API level 25. When using an AVD with API level 25 or higher, the emulator provides a simulated Wi-Fi access point ("AndroidWifi"), and Android automatically connects to it. https://developer.android.com/studio/run/emulator.html#wi-fi As of now, with Revision 26.1.3 of the android emulator, it is finally possible on the image v8 of the API 25. If the emulator was created before you upgrade to the latest API 25

Unable to listen to android wi-fi manager's state?

有些话、适合烂在心里 提交于 2019-11-27 03:36:20
问题 I am having some trouble with BroadCast receiver for checking the Wi-fi state. Could you please help? This is my manifest file. <uses-permission android:name="android.permission.READ_PHONE_STATE"> </uses-permission> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"> </uses-permission> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"> </uses-permission> <uses-permission android:name="android.permission.INTERNET"> </uses-permission> <application android

How to get each device's IP address in Wi-Fi Direct scenario?

别来无恙 提交于 2019-11-27 03:28:36
Starting from ICS, Wi-Fi Direct is introduced. Normally, we use the WifiP2pManager class to operate on Wi-Fi Direct, but it seems that it can only retrieve the GroupOwner IP address after connected. But, actually, any device all came negotiate to become the GroupOwner. In Upper Application, we need to get the peer's IP address, or each peer's IP address in a group so that we can send/communicate with them. How to get each IP address in Wi-Fi Direct? Include own IP address and each peer in the group? I encountered the same problem. Since both devices know the group owner's ip, it is already

How to turn off Wifi via ADB?

一世执手 提交于 2019-11-27 02:54:10
Im automating a testing procedure for wifi calling and I was wondering is there a way to turn off/on wifi via adb? I would either like to disable/enable wifi or kill wifi calling (com.movial.wificall) and restart it. Is it possible to do this all via adb and shell commands? so far I have found: android.net.wifi.WifiManager setWifiEnabled(true/false) Im just not sure how to put it together Jared Burrows Using "svc" through ADB (rooted required): Enable: adb shell su -c 'svc wifi enable' Disable: adb shell su -c 'svc wifi disable' Using Key Events through ADB: adb shell am start -a android

Detect 3G or Wifi Network restoration

喜你入骨 提交于 2019-11-27 02:51:13
问题 Is it possible to implement a PhoneStateListener(or any other mechanism) to detect when either the 3G or Wifi network connection is restored ? I see both LISTEN_DATA_CONNECTION_STATE and LISTEN_DATA_ACTIVITY say (cellular) in the API's summary. Does it mean 3G only ? Thanks 回答1: Better approach would be to use android.net.ConnectivityManager class. Register the receiver and monitor broadcasts. private class ConnectionMonitor extends BroadcastReceiver { @Override public void onReceive(Context

CONNECTIVITY_ACTION intent received twice when Wifi connected

风流意气都作罢 提交于 2019-11-27 02:49:41
In my app I have a BroadcastReceiver that is launched as a component through a <receiver> tag, filtering android.net.conn.CONNECTIVITY_CHANGE intents. My goal is simply to know when a Wifi connection was established, so what I am doing in onReceive() is this: NetworkInfo networkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); if(networkInfo.getType() == ConnectivityManager.TYPE_WIFI && networkInfo.isConnected()) { // Wifi is connected } It works fine, but I always seem to get two identical intents within about one second when a Wifi connection is established. I tried

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

孤者浪人 提交于 2019-11-27 02:00:36
问题 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 want to do this to keep continuity. (User may opt-in/out to/from this behaviour). Is there a special flag, lock, etc.. For this purpose? 回答1: This isn't possible on devices before Android 5.0 (Lollipop). The OS only keeps

How to turn on/off wifi hotspot programmatically in Android 8.0 (Oreo)

匆匆过客 提交于 2019-11-27 01:45:42
I know how to turn on/off wifi hot spot using reflection in android using below method. private static boolean changeWifiHotspotState(Context context,boolean enable) { try { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Method method = manager.getClass().getDeclaredMethod("setWifiApEnabled", WifiConfiguration.class, Boolean.TYPE); method.setAccessible(true); WifiConfiguration configuration = enable ? getWifiApConfiguration(manager) : null; boolean isSuccess = (Boolean) method.invoke(manager, configuration, enable); return isSuccess; } catch (Exception e) {

How to get the client device details which is connected to wifi hotspot?

百般思念 提交于 2019-11-27 01:42:00
问题 I am connecting different devices with wifi hotspot AP programatically in my android app, How can i detect the clients being connected and disconnected and to the wifi hotspot AP Programmatically ? Is there any callback event in Android API to give information regarding the connection or disconnection events of individual devices ? Thanks in advance. 回答1: Unfortunately there is no public API to give information about this... But you can read /proc/net/arp file and see the clients connected to