klydra / wifi_hunter Goto Github PK
View Code? Open in Web Editor NEWA flutter package to hunt down info from all WiFi APs around you.
License: BSD 3-Clause "New" or "Revised" License
A flutter package to hunt down info from all WiFi APs around you.
License: BSD 3-Clause "New" or "Revised" License
Error message
E/AndroidRuntime( 6045): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS flg=0x4000010 } in klydra.wifi_hunter.WiFiHunterPlugin$1@2f60c5df E/AndroidRuntime( 6045): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:874) E/AndroidRuntime( 6045): at android.os.Handler.handleCallback(Handler.java:739) E/AndroidRuntime( 6045): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime( 6045): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 6045): at android.app.ActivityThread.main(ActivityThread.java:5372) E/AndroidRuntime( 6045): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 6045): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 6045): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1125) E/AndroidRuntime( 6045): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:809) E/AndroidRuntime( 6045): Caused by: java.lang.IllegalStateException: Reply already submitted E/AndroidRuntime( 6045): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:286) E/AndroidRuntime( 6045): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:272) E/AndroidRuntime( 6045): at klydra.wifi_hunter.WiFiHunterPlugin$1.onReceive(WiFiHunterPlugin.java:108) E/AndroidRuntime( 6045): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:864) E/AndroidRuntime( 6045): ... 8 more I/Process ( 6045): killProcess pid=6045 I/Process ( 6045): java.lang.RuntimeException I/Process ( 6045): at android.os.Process.killProcess(Process.java:1106) I/Process ( 6045): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:99) I/Process ( 6045): at com.tencent.bugly.crashreport.crash.l.b(BUGLY:68) I/Process ( 6045): at com.tencent.bugly.crashreport.crash.l.uncaughtException(BUGLY:2) I/Process ( 6045): at cn.jiguang.b.a.uncaughtException(Unknown Source) I/Process ( 6045): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) I/Process ( 6045): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) I/Process ( 6045): Sending signal. PID: 6045 SIG: 9
Hello @klydra ,
I found ur package very useful, but I want to know whether there is any options/feature that I can listen to a particular SSID to get the live updates ?
After running the example app that you have provided, sometimes the app shows negative timestamp values. The timestamp value which is the microseconds passed after the device reboot shouldn't be negative and I suspect its happening because of int overflow. (timestamp is being cast to Int, shouldn't it be long?)
This is exactly what we need ๐
Any chances you port it for iOs?
I just clone this repo and build.
It just give me the error below
Launching lib/main.dart on LM Q510N in debug mode...
Error: Couldn't resolve the package 'wifi_scan' in 'package:wifi_scan/wifi_scan.dart'.
: Error: Not found: 'package:wifi_scan/wifi_scan.dart'
import 'package:wifi_scan/wifi_scan.dart';
^
: Error: Type 'WiFiAccessPoint' not found.
List accessPoints = [];
^^^^^^^^^^^^^^^
: Error: Type 'WiFiAccessPoint' not found.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^^^^^^^^^^
: Error: Type 'GetScannedResultsErrors' not found.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^^^^^^^^^^^^^^^^^^
: Error: Type 'Result' not found.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^
: Error: Expected 0 type arguments.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^
: Error: Type 'WiFiAccessPoint' not found.
Result<List, GetScannedResultsErrors> result) {
^^^^^^^^^^^^^^^
: Error: Type 'GetScannedResultsErrors' not found.
Result<List, GetScannedResultsErrors> result) {
^^^^^^^^^^^^^^^^^^^^^^^
: Error: Type 'Result' not found.
Result<List, GetScannedResultsErrors> result) {
^^^^^^
: Error: Expected 0 type arguments.
Result<List, GetScannedResultsErrors> result) {
^
: Error: Type 'WiFiAccessPoint' not found.
Widget _buildAccessPointTile(BuildContext context, WiFiAccessPoint ap) {
^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMethodCodec'.
const MethodChannel(this.name, [this.codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger ])
^^^^^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMethodCodec'.
const OptionalMethodChannel(String name, [MethodCodec codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger])
^^^^^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMethodCodec'.
const EventChannel(this.name, [this.codec = const StandardMethodCodec(), BinaryMessenger? binaryMessenger])
^^^^^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMethodCodec'.
JSONMethodCodec(),
^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMethodCodec'.
JSONMethodCodec(),
^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMethodCodec'.
JSONMethodCodec(),
^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMessageCodec'.
JSONMessageCodec(),
^^^^^^^^^^^^^^^^
: Error: Method not found: 'StringCodec'.
StringCodec(),
^^^^^^^^^^^
: Error: Method not found: 'JSONMessageCodec'.
JSONMessageCodec(),
^^^^^^^^^^^^^^^^
: Error: Method not found: 'StandardMessageCodec'.
StandardMessageCodec(),
^^^^^^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMethodCodec'.
JSONMethodCodec(),
^^^^^^^^^^^^^^^
: Error: Method not found: 'JSONMethodCodec'.
JSONMethodCodec(),
^^^^^^^^^^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
List accessPoints = [];
^^^^^^^^^^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
List accessPoints = [];
^^^^^^^^^^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^^^^^^^^^^
: Error: 'GetScannedResultsErrors' isn't a type.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^^^^^^^^^^^^^^^^^^
: Error: 'Result' isn't a type.
StreamSubscription<Result<List, GetScannedResultsErrors>>?
^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
Result<List, GetScannedResultsErrors> result) {
^^^^^^^^^^^^^^^
: Error: 'GetScannedResultsErrors' isn't a type.
Result<List, GetScannedResultsErrors> result) {
^^^^^^^^^^^^^^^^^^^^^^^
: Error: 'Result' isn't a type.
Result<List, GetScannedResultsErrors> result) {
^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
setState(() => accessPoints = []);
^^^^^^^^^^^^^^^
: Error: The getter 'WiFiScan' isn't defined for the class '_MyAppState'.
'_MyAppState' is from 'package:flutter/src/services/message_codecs.dart' ('../../../../../sdk/flutter/packages/flutter/lib/src/services/message_codecs.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WiFiScan'.
subscription = WiFiScan.instance.onScannedResultsAvailable
^^^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
Widget _buildAccessPointTile(BuildContext context, WiFiAccessPoint ap) {
^^^^^^^^^^^^^^^
: Error: 'WiFiAccessPoint' isn't a type.
setState(() => accessPoints = []);
^^^^^^^^^^^^^^^
: Error: The getter 'WiFiScan' isn't defined for the class '_MyAppState'.
'_MyAppState' is from 'package:flutter/src/services/message_codecs.dart' ('../../../../../sdk/flutter/packages/flutter/lib/src/services/message_codecs.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WiFiScan'.
future: WiFiScan.instance.hasCapability(),
^^^^^^^^
: Error: The getter 'WiFiScan' isn't defined for the class '_MyAppState'.
'_MyAppState' is from 'package:flutter/src/services/message_codecs.dart' ('../../../../../sdk/flutter/packages/flutter/lib/src/services/message_codecs.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WiFiScan'.
final error = await WiFiScan.instance.startScan();
^^^^^^^^
: Error: The getter 'WiFiScan' isn't defined for the class '_MyAppState'.
'_MyAppState' is from 'package:flutter/src/services/message_codecs.dart' ('../../../../../sdk/flutter/packages/flutter/lib/src/services/message_codecs.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'WiFiScan'.
await WiFiScan.instance.getScannedResults()),
^^^^^^^^
: Error: Couldn't find constructor 'StandardMessageCodec'.
return const StandardMessageCodec().decodeMessage(encoded) as Map<Object?, Object?>?;
^^^^^^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMessageCodec'.
final ByteData encoded = const StandardMessageCodec().encodeMessage(data)!;
^^^^^^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMessageCodec'.
const StandardMessageCodec().encodeMessage(object);
^^^^^^^^^^^^^^^^^^^^
: Error: Couldn't find constructor 'StandardMessageCodec'.
args != null ? const StandardMessageCodec().decodeMessage(args) : null,
^^^^^^^^^^^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Awifi_scan%2Fwifi_scan.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:623:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:763:21)
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9)
FAILURE: Build failed with an exception.
Where:
Script '/Users/kevin/sdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/kevin/sdk/flutter/bin/flutter'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 10s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:async';
import 'package:wifi_hunter/wifi_hunter.dart';
import 'package:wifi_hunter/wifi_hunter_result.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
WiFiHunterResult wiFiHunterResult = WiFiHunterResult();
Future<void> huntWiFis() async {
try {
wiFiHunterResult = (await WiFiHunter.huntWiFiNetworks)!;
} on PlatformException catch (exception) {
print(exception.toString());
}
for (var i = 0; i < wiFiHunterResult.results.length; i++) {
print(wiFiHunterResult.results[1].ssid);
print(wiFiHunterResult.results[1].bssid);
print(wiFiHunterResult.results[1].capabilities);
print(wiFiHunterResult.results[1].frequency);
print(wiFiHunterResult.results[1].level);
print(wiFiHunterResult.results[1].channelWidth);
print(wiFiHunterResult.results[1].timestamp);
}
if (!mounted) return;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('WiFiHunter example app'),
),
body: ElevatedButton(
onPressed: () => huntWiFis(),
child: const Text('Hunt Networks'),
),
),
);
}
}
I get this error while building:
.pub-cache/hosted/pub.dartlang.org/wifi_hunter-1.1.0/android/src/main/java/klydra/wifi_hunter/WiFiHunterPlugin.java uses or overrides a deprecated API.
I am using package example and i'm taking this issue ;
PlatformException(2, WiFi Scan failed. Most likely your app is being throttled. Check out https://developer.android.com/guide/topics/connectivity/wifi-scan#wifi-scan-throttling for more information., null, null)
How can i solve this?
Is there any change iOS support will get built in?
Hi,
I am Federico and I'm using this Flutter libraty to get the list of APs from my phone, but I can't see any info. I implemented my code in a very similar way as the example code, but with no success.
Can you give me more details on how to get AP list in the proper way?
Thank you.
It's possible to get the Wifi channel?
Thanks;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.