При сканировании доступного wifi получено исключение - java .lang.IllegalStateException: ответ уже отправлен - PullRequest
2 голосов
/ 28 февраля 2020

Пока я запрашиваю доступный список Wi-Fi в сети, используя wifi , получая ниже исключения.

Исключение :

E/MethodChannel#plugins.ly.com/wifi(29023): Failed to handle method call
E/MethodChannel#plugins.ly.com/wifi(29023): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:151)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithError(WifiDelegate.java:341)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithAlreadyActiveError(WifiDelegate.java:337)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.getWifiList(WifiDelegate.java:172)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiPlugin.onMethodCall(WifiPlugin.java:58)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#plugins.ly.com/wifi(29023):     at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/flutter (29023): PlatformException(error, Reply already submitted, null)
E/MethodChannel#plugins.ly.com/wifi(29023): Failed to handle method call
E/MethodChannel#plugins.ly.com/wifi(29023): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:151)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithError(WifiDelegate.java:341)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithAlreadyActiveError(WifiDelegate.java:337)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.getWifiList(WifiDelegate.java:172)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiPlugin.onMethodCall(WifiPlugin.java:58)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#plugins.ly.com/wifi(29023):     at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/flutter (29023): PlatformException(error, Reply already submitted, null)
E/MethodChannel#plugins.ly.com/wifi(29023): Failed to handle method call
E/MethodChannel#plugins.ly.com/wifi(29023): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:151)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithError(WifiDelegate.java:341)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.finishWithAlreadyActiveError(WifiDelegate.java:337)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiDelegate.getWifiList(WifiDelegate.java:172)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.ly.wifi.WifiPlugin.onMethodCall(WifiPlugin.java:58)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#plugins.ly.com/wifi(29023):     at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#plugins.ly.com/wifi(29023):     at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#plugins.ly.com/wifi(29023):     at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#plugins.ly.com/wifi(29023):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/flutter (29023): PlatformException(error, Reply already submitted, null)

Код:

Future<List<WifiResult>> getAvailableWifi() async {
List<WifiResult> filteredList = [];
bool match = true;

return Wifi.list('');
List<WifiResult> wifis =  await Wifi.list('');
return wifis;
}

1 Ответ

1 голос
/ 06 марта 2020

Использование WifiManager.startScan() ограничено 4 проверками каждые 2 минуты. - Все объединенные фоновые приложения ограничены одним сканированием каждые 30 минут. "

Проверьте, звоните ли вы WifiManager.startScan() более четырех раз в течение 2 минут.

Ссылка : https://developer.android.com/guide/topics/connectivity/wifi-scan#wifi -сканирование

...