z-network-scanner-plugin
v0.0.12
Published
Capacitor plugin to scan local network devices (IP, MAC, etc.)
Maintainers
Readme
Z Network Scanner Plugin
A custom Capacitor plugin for scanning the local Wi-Fi network and retrieving connected device information such as IP addresses, MAC addresses, and hostnames. Designed for the Smart-QR mobile app (Ionic + Angular 20 + Capacitor 7).
🚀 Features
- Scan devices connected to the same Wi-Fi network
- Retrieve IP Address, MAC Address, and Hostname
- Works on Android with Capacitor 7
- Simple Java + Capacitor plugin
- Lightweight and fast network discovery
- Can be integrated easily into any Ionic project
📦 Installation
This plugin is installed locally under:
smart-qr/plugins/z-network-scanner-plugin/To rebuild and sync the plugin:
npm install
npx cap syncIf you made Java changes:
cd android
./gradlew clean
cd ..
npx cap sync android📡 Usage (Ionic / Angular)
Import the plugin:
import { Plugins } from '@capacitor/core';
const { ZNetworkScanner } = Plugins;▶️ Example: Scan Network
async scanNetwork() {
const result = await ZNetworkScanner.scanNetwork();
console.log('Scan Result:', result.devices);
}📚 API Documentation
scanNetwork()
Scans the Wi-Fi network and returns a list of connected devices.
Returns:
{
devices: {
ip: string;
mac: string;
hostname?: string;
}[];
}getCurrentIP()
Returns the device’s current local IP address.
Returns:
{
ip: string;
}ping(ip: string)
Pings an IP address on the network.
Parameters:
- ip: string — target IP
Returns:
{
success: boolean;
time?: number;
}📱 Android Permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />If scanning ARP/MAC:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />🛠 Development & Rebuild
After editing TypeScript:
npm run build
npx cap syncAfter editing Java:
cd android
./gradlew clean
cd ..
npx cap sync android🧪 Testing
ZNetworkScanner.scanNetwork().then(r => console.log(r));
ZNetworkScanner.getCurrentIP().then(r => console.log(r));📜 License
Private – Zidan-Tech QR
