android-wifi

wifi search for the devices connected to the same network i.e other than acces point(for android)

纵然是瞬间 提交于 2019-11-30 16:56:13
i want to make a modification to my project and right now the project status is..... it is searches the available WiFi networks and shows the list with info of the network this works properly.Now i want to search and see the details of the devices connected to the network. Is there any way to find these devices ? Your comment will be useful for me, Thanks. Would you like to discover a specific device ? Or you need the list of all connected devices? The second I don't think is possible. EDIT Discovering specific devices: Using UDP Broadcast . Some reference can be found here ! There are some

WiFi getScanResults returns an empty list if GPS is off. (Android 6.0.1)

走远了吗. 提交于 2019-11-30 15:16:25
i tried to explain the problem in this gif basically, this test app receives an "RSSI_CHANGED" intent and displays the scan results on the screen. scan results are always empty unless GPS is enabled. I guess my question is why? To access the hardware identifiers of nearby external devices via Bluetooth and Wi-Fi scans, your app must now have the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions I have "ACCESS_COARSE_LOCATION" granted You must declare ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION . A location permission is required because Bluetooth scans can be used to gather

How to mock Context using Mockito?

一笑奈何 提交于 2019-11-30 14:33:25
问题 I'm using Context to access system level services like WifiManager and BluetoothManager. How to mock this getApplicationContext() using Mockito? 回答1: Let's have a look at the following class: MockContext If you need more insight, check the Official Testing Fundamentals page 回答2: Context context = mock(Context.class); 回答3: If you want to get the context with Kotlin and Mockito , you can do it in the following way: mock(Context::class.java) 来源: https://stackoverflow.com/questions/34063848/how

Android wifi getting frequency of the connected Wifi

こ雲淡風輕ζ 提交于 2019-11-30 14:12:54
问题 Well i have ScanResults and from there i can have SSID , BSSID , Frequency of all the wifi's. List<ScanResult> results = wifi.getScanResults(); Also i have the Connected wifi info so from there also i am having SSID of connected and BSSID of the connected wifi. WifiManager wifi; WifiInfo info; wifi = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); info = wifi.getConnectionInfo(); Now i only want to have the frequency of the connected wifi but when i check SSID and BSSID

How to keep CPU from 'sleeping' when screen is turned off in Android?

試著忘記壹切 提交于 2019-11-30 13:54:39
问题 I have an application in which I am sending network data over WiFI. Everything is fine until I turn the display off or the device goes to 'sleep'. I'm already locking the WiFi however, it seems to be the case that the CPU speed ramps down when in sleep which causes my streaming to not behave properly (i.e. packets don't flow as fast as I would like as they do when the device is not sleeping). I know that I possibly can/possibly should address this at the protocol level however, that might

Is there any way to get notified when known SSIS wifi networks get in/out of range?

南楼画角 提交于 2019-11-30 13:15:48
问题 I want to write an application which consists on perform actions when a known wifi networks get in or out of range. For example, let's say my home wifi network's SSIS is "WifiHome", and i want to make a notification "You just left home!" whenever the device can't detect this specific network anymore. (Or alternativly - "You just entered home" when the device re-detect signals from this network). My question is: Is is possible to listen to those changes without polling the available-network

android 6.0.1 force wifi connection with no internet access

空扰寡人 提交于 2019-11-30 11:39:48
this has many similar questions (google for: "no internet access detected. won't automatically reconnect." or: android force wifi connection programmatically). i thought i had a answer here , but it stopped working after installing 6.0.1 updates (i have may 1 security patches). seems like this is a behaviour change . i have some 2013 nexus 7's with 6.0.1 that run a kiosk type app and want to connect programmatically to a specific wireless network that has no internet connection. each tablet has a unique static ip address of the form: 192.168.0.xx. i use the normal java socket constructors and

How to detect if a network is (configured as) a mobile hotspot on Android?

假如想象 提交于 2019-11-30 09:26:28
As of Android 4.1, your device can detect if it's connected to a mobile hotspot (given that the mobile hotspot is also running Android 4.1 or higher). Also, you have the option to flag networks as mobile hotspots (under Settings / Data Usage / Overflow menu / Mobile Hotspots). But how do I detect this as a -user- I meant developer? It's not stored in the WifiConfiguration, so where is it? Some context: I want to build a simple tool for Android that checks if you are connected to a network that you or Android has flagged as a mobile hotspot. If so, it will check if no other (non-hotspot)

Android's proxy confusing documentation resources

ε祈祈猫儿з 提交于 2019-11-30 09:18:05
It seems to me that there is a lot of confusing resources regarding the proxy topic on Android. First of all, it seems that all the methods of the Proxy class are declared deprecated and it's suggested to: "Use standard java vm proxy values to find the host, port and exclusion list. This call ignores the exclusion list." The official java vm proxy values can be accessed in the following way: System.getProperty("http.proxyHost") System.getProperty("http.proxyPort") System.getProperty("http.nonProxyHosts") This could seem confirmed by the documentation of the ProxySelector class . But trying on

BroadcastReceiver declared in manifest is not receiving the Broadcast

空扰寡人 提交于 2019-11-30 08:49:47
I've tried to register a Wifi BroadcastReceiver to get the wifi state when it changes. But so far I have no luck receiving the broadcast. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <receiver android:name=".WifiReceiver" > <intent-filter> <action android:name="android.net.wifi.WifiManager.WIFI_STATE_CHANGED_ACTION" /> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> //activity declaration here... </application> Do you guys know how to register the BraodcastReceiver in manifest? I don't want to register it in