An open API service indexing awesome lists of open source software.

https://github.com/mvdan/accesspoint

Manage wireless access points in Android (abandoned)
https://github.com/mvdan/accesspoint

access-point android java tethering wireless

Last synced: 6 months ago
JSON representation

Manage wireless access points in Android (abandoned)

Awesome Lists containing this project

README

          

# accesspoint

[![Build Status](https://travis-ci.org/mvdan/accesspoint.svg?branch=master)](https://travis-ci.org/mvdan/accesspoint)

Manage wireless access points on Android 2.2 or later.

Note that this project is **abandoned** since its method doesn't work on Android
7.1 or later. Have a look at these newer alternatives that have been tested to
work on Android 8.0:

* https://github.com/shinilms/direct-net-share
* https://github.com/geekywoman/direct-net-share
* https://github.com/aegis1980/WifiHotSpot

### Quick start

```gradle
repositories {
jcenter()
}

dependencies {
compile 'cc.mvdan.accesspoint:library:0.2.0'
}
```

```java
import cc.mvdan.accesspoint.WifiApControl;

WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiApControl apControl = WifiApControl.getInstance(context);

boolean enabled = apControl.isEnabled();
int state = apControl.getState();

WifiConfiguration config = apControl.getConfiguration();
Inet4Address addr4 = apControl.getInet4Address();
Inet6Address addr6 = apControl.getInet6Address();

// These are cached and may no longer be connected, see
// WifiApControl.getReachableClients(int, ReachableClientListener)
List clients = apControl.getClients()

// Wifi must be disabled to enable the access point
wifiManager.setWifiEnabled(false);
apControl.enable();

apControl.disable();
wifiManager.setWifiEnabled(true);
```

Remember to ask for `WRITE_SETTINGS` on 6.0+! The example app has a
sample implementation of that. The library will not do this for you, as
it involves UI interaction that should be handled and customizable by
your app.

### Features

* Enabling and disabling your AP
* Configuring your AP via `WifiConfiguration`
* Getting your device's IP address in your AP network
* Getting the list of clients connected to your AP

### Permissions

You will need the following:

```xml

```

### How does it work?

Enabling, disabling and configuring of wireless Access Points are all
unaccessible in the SDK behind hidden methods in `WifiManager`. Reflection is
used to get access to those methods.

Getting your own IP address is done by getting the IP address that is
associated with the wireless network interface.

Getting the list of clients consists of parsing `/proc/net/arp` and parsing
each line to see what devices are neighbours in our wireless network.

An extra method is available to get the list of reachable clients, since the
arp table is cached for up to a few minutes. The method asynchronously tests
the reachability of each client.

### License

Published under the Apache2 license.