Cordova HotSpot Plugin
A Cordova plugin for managing HotSpot networks on Android with Cordova 3.4.0 / API Level 19
Installation
$ cordova plugin add cordova-plugin-hotspot
Usage
Check if Plugin is available
cordova.plugins.hotspot.isAvailable(
function (isAvailable) {
}
);
Check if device is connected to internet
cordova.plugins.hotspot.isConnectedToInternet(
function () {
},function () {
}
);
Get connection configuration
cordova.plugins.hotspot.getConnectionInfo(
function (result) {
},function () {
}
);
Get network configuration
cordova.plugins.hotspot.getNetConfig(
function (result) {
},function () {
}
);
Ping a host
cordova.plugins.hotspot.pingHost(ip,
function (result) {
if(result){
} else {
}
},function () {
}
);
Get MAC address of host
cordova.plugins.hotspot.getMacAddressOfHost(ip,
function (result) {
if(result){
} else {
}
},function () {
}
);
Check DNS is alive
cordova.plugins.hotspot.isDnsLive(ip,
function (live) {
if(live){
} else {
}
},function () {
}
);
Check port is alive
cordova.plugins.hotspot.isPortLive(ip,
function (live) {
if(live){
} else {
}
},function () {
}
);
Check if device is rooted
cordova.plugins.hotspot.isRooted(
function (rooted) {
if(rooted){
} else {
}
},function () {
}
);
Hotspot functionality
Create Hotspot
cordova.plugins.hotspot.createHotspot(ssid, mode, password,
function () {
},function () {
}
);
Start Hotspot
cordova.plugins.hotspot.startHotspot(
function () {
},function () {
}
);
Configure Hotspot
cordova.plugins.hotspot.configureHotspot(ssid, mode, password,
function () {
},function () {
}
);
Stop Hotspot
cordova.plugins.hotspot.stopHotspot(
function () {
},function () {
}
);
Check if Hotspot is enabled
cordova.plugins.hotspot.isHotspotEnabled(
function () {
},function () {
}
);
Get all connected devices
cordova.plugins.hotspot.getAllHotspotDevices(
function (devices) {
},function (err) {
}
);
Wifi
Check if Wifi is supported
cordova.plugins.hotspot.isWifiSupported(
function () {
},function () {
}
);
Check if Wifi is enabled
cordova.plugins.hotspot.isWifiOn(
function () {
},function () {
}
);
Toggle Wifi
cordova.plugins.hotspot.toggleWifi(
function (isActive) {
},function (err) {
}
);
Connect to Wifi
cordova.plugins.hotspot.connectToHotspot(ssid, password,
function () {
},function () {
}
);
Check if device is connected to internet via Wifi
cordova.plugins.hotspot.isConnectedToInternetViaWifi(
function () {
},function () {
}
);
Check if Wifi Direct is supported
cordova.plugins.hotspot.isWifiDirectSupported(
function () {
},function () {
}
);
Add a network config
cordova.plugins.hotspot.addWifiNetwork(ssid, mode, password,
function () {
},function (err) {
}
);
Delete a network config
cordova.plugins.hotspot.removeWifiNetwork(ssid,
function () {
},function (err) {
}
);
Start a periodically scan
cordova.plugins.hotspot.startPeriodicallyScan(interval, duration,
function () {
},function (err) {
}
);
Scan network
cordova.plugins.hotspot.scanWifi(
function (listOfNetworks) {
},function (err) {
}
);
Scan network by level
cordova.plugins.hotspot.scanWifiByLevel(
function (listOfNetworks) {
},function (err) {
}
);
Stop a periodically scan
cordova.plugins.hotspot.stopPeriodicallyScan(
function () {
},function (err) {
}
);