Socket
Book a DemoInstallSign in
Socket

nativescript-wifi-info

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-wifi-info

NativeScript plugin for retrieving device's wifi information details

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

NativeScript Wifi Info Plugin apple android

A plugin for retrieving device's wifi information details.

Prerequisites / Requirements

iOS

Make sure that your app has Access WiFi Information capability.

XCode > Open app > Capabilities > Access Wifi Information (ON)

Installation

tns plugin add nativescript-wifi-info

Usage

The wifi info plugin exposes a simple WifiInfo() class with several instance methods. To get the device's current Wifi SSID, instantiate an instance of WifiInfo and call its getSSID() method.

Angular

import {Component, OnInit} from '@angular/core';
import {WifiInfo} from 'nativescript-wifi-info';

@Component({
    selector: 'Home',
    moduleId: module.id,
    templateUrl: './home.component.html'
})
export class HomeComponent implements OnInit {

    ssid: string;
    nativeSsid: string;

    private wifiInfo: WifiInfo;

    constructor() {
        this.wifiInfo = new WifiInfo();
    }

    ngOnInit(): void {
        this.ssid = this.wifiInfo.getSSID();
        this.nativeSsid = this.wifiInfo.getNativeSSID();
    }
}

TypeScript

import { WifiInfo } from 'nativescript-wifi-info';

const wifiInfo = new WifiInfo();
const ssid = wifiInfo.getSSID();
const nativeSsid = wifiInfo.getNativeSSID();

console.log('Wifi SSID', ssid);
console.log('Wifi SSID (native)', nativeSsid);

The plugin is currently set up to use:

  • iOS MMLanScan library https://github.com/mavris/MMLanScan
  • Android native WifiManager API (android.net.wifi.WifiManager)

Additional Examples

Scan Wifi Network and show available Wifi SSID list (Android only)

In angular app there is a simple implementation of scanning wifi network and populating wifi ssid list.

Known Issues

Getting Wifi SSID is not working on iOS simulator (returns No WiFi Available). On Android it should detect a default demo Wifi Network AndroidWifi.

License

MIT

Keywords

NativeScript

FAQs

Package last updated on 09 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts