Wifi Direct peer discovery in API 26 (Oreo)
Wifi Direct peer discovery in API 26 (Oreo)
I'm developing a Wifi Direct APP following the Wifi Direct Demo and it works between devices whose API is below to 26. In API 26 it doesn´t work properly because it doesn´t detect any peer in the APP , peers.size() = returns 0 (but it is detected through settings ->Wifi..wifi direct, the other peer).
If the device whose API is 26 try to connect it doesn´t work, but if the device whose API is below to API 26 try to connect to API 26 device, connection works (although any peer is detected in API 26 device).
Why are peers not detected in the APP but do appear in settings (Detection works in the APP for APIs below 26)?
Is there a new restriction from API 26?
I get the following logs:
06-20 00:16:29.625 1157-1157/? E/wificond: NL80211_CMD_TRIGGER_SCAN failed: Device or resource busy
06-20 00:16:29.625 1481-2605/? E/WificondScannerImpl: Failed to start scan, freqs=null
06-20 00:16:29.628 1481-1481/? D/WifiProfileMgrReceiver: handleEvent : android.net.wifi.SCAN_RESULTS
06-20 00:16:29.631 1481-1481/? D/WifiProfileUtil: [getMccMnc] Add Slot 0 SubId 1
06-20 00:16:29.637 1481-18547/? D/WifiPermissionsUtil: Denied: no location permission
06-20 00:16:29.742 1206-2847/? I/LOWI-8.5.0.3.a: [LOWI-Scan] lowi_close_record:Scan completed in 2765827ms and Recieved 0 APs scan results
06-20 00:16:29.743 1206-1279/? I/LOWI-8.5.0.3.a: [LOWIUtils] responseToOutPostcard - TO: GTP-FDAL, FROM: LOWI-SERVER, RESP: LOWI_ASYNC_DISCOVERY_SCAN_RESULTS
06-20 00:16:29.743 1157-1157/? E/wificond: Failed to get interface index from scan result notification
06-20 00:16:29.744 1208-1445/? W/XTCC-6.1.2.10: [LOWIUtils] to_eScanTypeResponse - default case
06-20 00:16:29.744 1208-1445/? E/XTCC-6.1.2.10: [FDAL_Manager] handleFreeWiFiScanResult: failed: 11
06-20 00:16:30.011 1206-2847/? I/LOWI-8.5.0.3.a: [LOWI-Scan] lowi_close_record:Scan completed in 2766096ms and Recieved 0 APs scan results
06-20 00:16:30.012 1206-1279/? I/LOWI-8.5.0.3.a: [LOWIUtils] responseToOutPostcard - TO: GTP-FDAL, FROM: LOWI-SERVER, RESP: LOWI_ASYNC_DISCOVERY_SCAN_RESULTS
06-20 00:16:30.013 1208-1445/? W/XTCC-6.1.2.10: [LOWIUtils] to_eScanTypeResponse - default case
06-20 00:16:30.013 1208-1445/? E/XTCC-6.1.2.10: [FDAL_Manager] handleFreeWiFiScanResult: failed: 11
06-20 00:16:30.483 1206-2847/? I/LOWI-8.5.0.3.a: [LOWI-Scan] lowi_close_record:Scan completed in 2766568ms and Recieved 0 APs scan results
06-20 00:16:30.484 1206-1279/? I/LOWI-8.5.0.3.a: [LOWIUtils] responseToOutPostcard - TO: GTP-FDAL, FROM: LOWI-SERVER, RESP: LOWI_ASYNC_DISCOVERY_SCAN_RESULTS
06-20 00:16:30.485 1208-1445/? W/XTCC-6.1.2.10: [LOWIUtils] to_eScanTypeResponse - default case
06-20 00:16:30.486 1208-1445/? E/XTCC-6.1.2.10: [FDAL_Manager] handleFreeWiFiScanResult: failed: 11
06-20 00:16:30.849 1206-2847/? I/LOWI-8.5.0.3.a: [LOWI-Scan] lowi_close_record:Scan completed in 2766934ms and Recieved 0 APs scan results
06-20 00:16:30.850 1206-1279/? I/LOWI-8.5.0.3.a: [LOWIUtils] responseToOutPostcard - TO: GTP-FDAL, FROM: LOWI-SERVER, RESP: LOWI_ASYNC_DISCOVERY_SCAN_RESULTS
06-20 00:16:30.852 1208-1445/? W/XTCC-6.1.2.10: [LOWIUtils] to_eScanTypeResponse - default case
I added location permissions(ACCESS_FINE_LOCATION) but I keep getting this error:
Failed to get interface index from scan result notification
No i don´t. The problem is that it enters the part of the code in which peers.size() = 0. In APIS belows it works properly.
– Dani
Jun 9 at 12:20
Sorry I had looked at it wrong. I edit the question showing the logs.
– Dani
Jun 19 at 22:40
1 Answer
1
Finally I have solved it: Settings -> General -> Applications and notifications -> Application information -> Select your APP -> Permissions-> enable your location.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
do you see any error in logcat?
– Sagar
Jun 9 at 11:37