https://github.com/tejmagar/androidwifitools
Android library for finding connected devices on the same WiFi network. It can provide IP Addresses, device names, MAC Address and vendor names.
https://github.com/tejmagar/androidwifitools
android ipaddress macaddress networking tools wifi
Last synced: about 2 months ago
JSON representation
Android library for finding connected devices on the same WiFi network. It can provide IP Addresses, device names, MAC Address and vendor names.
- Host: GitHub
- URL: https://github.com/tejmagar/androidwifitools
- Owner: tejmagar
- Created: 2021-07-01T06:22:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-27T15:24:30.000Z (over 1 year ago)
- Last Synced: 2025-07-25T18:01:24.205Z (3 months ago)
- Topics: android, ipaddress, macaddress, networking, tools, wifi
- Language: Java
- Homepage:
- Size: 1.55 MB
- Stars: 26
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Android WiFi Tools
Android library for finding connected devices on the same WiFi network. It can provide IP Addresses, device names, MAC Address and vendor names.
\
[](https://www.buymeacoffee.com/tejmagar)
## Alternative [Use this instead]
https://github.com/tejmagar/AndroidNetworkTools use this instead.## Usage
Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```### Add the dependency
```gradle
dependencies {
implementation 'com.github.tejmagar:AndroidWiFiTools:1.0.2'
}
```### Add Permission
```xml
```
### Update build.gradle(:app) for Android 11
```gradle
android {
...
defaultConfig {
...
//noinspection OldTargetApi
targetSdkVersion 29
...
}
}
```### Find Connected Devices
```java
DevicesFinder devicesFinder = new DevicesFinder(this, new OnDeviceFindListener() {
@Override
public void onStart() {}
@Override
public void onDeviceFound(DeviceItem deviceItem) {
}@Override
public void onComplete(List deviceItems) {}
@Override
public void onFailed(int errorCode) {}
});
devicesFinder.start();
```### Set Timeout
Increasing timeout value may give you better results.```java
devicesFinder.setTimeout(5000).start();
```### Get Mac Address from IP Address
```java
String macAddress = MacAddressInfo.getMacAddressFromIp("192.168.1.1");
```
Before running this code, make sure you have already run ```deviceFinder.start();``` method.Returns device Mac Address. If not found, it will return "unknown" or ```Constants.UNKOWN```
### Get current device IP Address
```java
String ipAddress = devicesFinder.getCurrentDeviceIpAddress();
// or
String ipAddress = Utils.getCurrentDeviceIpAddress();
```### Get current device Mac Address
```java
String currentDeviceIpAddress = devicesFinder.getCurrentDeviceIpAddress();
String currentDeviceMacAddress = MacAddressInfo.getCurrentDeviceMacAddress(currentDeviceIpAddress);
```### Get vendor name from Mac Address
```java
String vendorName = VendorInfo.getVendorName("94:17:00:3a:f9:09");
```returns device Mac Address. If not found, it will return "unknown" or ```Constants.UNKNOWN```
```VendorInfo.init(context);``` will be automatically called while starting the device finder. If not, make sure you have initialized it first.