devstepbcn / react-native-android-wifi

A react-native module for viewing and connecting to Wifi networks on Android devices.
ISC License
212 stars 121 forks source link

WifiManager.startScan() was deprecated in API level 28 #99

Open t-ricci-enhancers opened 4 years ago

t-ricci-enhancers commented 4 years ago

The documentation of the Android SDK states that:

This method was deprecated in API level 28.
The ability for apps to trigger scan requests will be removed in a future release.

Do you know if there will be an alternative API for the same purpose? Also will the plugin prevent crashes if in a future Android release if an app using the plugin will try to scan for networks?

[https://developer.android.com/reference/android/net/wifi/WifiManager.html#startScan()](https://developer.android.com/reference/android/net/wifi/WifiManager.html#startScan())

bareynol commented 4 years ago

I'm on Android API level 29, and running reScanAndLoadWifiList, which uses WifiManager.startScan() does not run the callback function provided (nor does it run the error handler provided).

This is a breaking issue for me, since loadWifiList always returns an empty array.

I can verify that the app does have the required permissions enabled, wifi is turned on, and going to the phone's Wifi settings, there are networks listed.

EDIT: Nevermind. The reason for this was that location services were not enabled.

tranvanhien187 commented 3 years ago

Tôi đang ở cấp API Android 29 và đang chạy reScanAndLoadWifiList, sử dụng WifiManager.startScan()không chạy hàm gọi lại được cung cấp (cũng như không chạy trình xử lý lỗi được cung cấp).

Đây là một vấn đề khó khăn đối với tôi, vì loadWifiListluôn trả về một mảng trống.

Tôi có thể xác minh rằng ứng dụng đã bật các quyền cần thiết, Wi-Fi đã được bật và đi tới cài đặt Wifi của điện thoại, có các mạng được liệt kê.

CHỈNH SỬA: Đừng bận tâm. Lý do cho điều này là các dịch vụ vị trí không được kích hoạt.

Can you tell me how do you solve this problem ?

t-ricci-enhancers commented 3 years ago

Personally I switched to: https://github.com/JuanSeBestia/react-native-wifi-reborn