WifiWizard2 icon indicating copy to clipboard operation
WifiWizard2 copied to clipboard

SCAN_FAILED after 4 scans

Open mishkeTz opened this issue 5 years ago • 1 comments

Prerequisites

Check all boxes if you have done the following:

  • [x] Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
  • [x] Make sure you fill out the Issue Type below

Issue type

Select all that apply

  • [x] Bug
  • [ ] Enhancement
  • [ ] Task
  • [ ] Question
  • [ ] Other

Description

I have a button that triggers scan on click. When I try to scan for 5th time it fails with an error message 'SCAN_FAILED'. Every time after 4 successful scans it fails for no reason.

Steps to Reproduce

  1. Fresh cordova instalation
  2. Install this package and run WifiWizard2.scan().then((res) => { }).catch(() => { })
  3. Try it out on Android 9 (In my case Samsung S8)

Expected behavior: To get scan results.

Actual behavior: Get an error message 'SCAN_FAILED' after 4 successful scans. It always fails at 5th scan.

Reproduces how often: Every 5th scan.

Versions

Please include the plugin version that you are using and also include the OS, version and device you are using.

Plugin version: 3.1.1 Android: 9 Cordova: 9.0.0

EDIT: Maybe it has to do something with calling it too often and throttling of WiFi happens and the OS is blocking it? If someone more experienced can clarify this in more details I would appreciate it.

mishkeTz avatar Jan 17 '20 21:01 mishkeTz

I just googled your assumption regarding throttling and found the following:

Android 9: Each foreground app can scan four times in a 2-minute period. This allows for a burst of scans in a short time.

All background apps combined can scan one time in a 30-minute period.

Android 10 and higher: The same throttling limits from Android 9 apply. There is a new developer option to toggle the throttling off for local testing (under Developer Options > Networking > Wi-Fi scan throttling).

See: https://developer.android.com/guide/topics/connectivity/wifi-scan#wifi-scan-throttling

I guess we can close this then.

/cc: @tripflex

xLarry avatar Feb 26 '20 17:02 xLarry