New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nativescript-telephony

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-telephony

A Nativescript plugin to get the device's SIM data (carrier name, mcc mnc, country code, telephonenumber, etc)

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

NativeScript-Telephony

This is a Nativescript plugin to get data from the SIM card like the carrier name, mcc, mnc and country code and other system dependent additional info.

Contributors

Peter Bakondy for his work on cordova-plugin-sim. Basically this is his plugin. I followed his source code as a guide.

Supported Platforms

  • Android
  • iOS

Installation

tns plugin add nativescript-telephony

Usage

Typescript

import {Telephony} from 'nativescript-telephony';

Telephony().then(function(resolved) {
	console.log('resolved >', resolved)
	console.dir(resolved);
}).catch(function(error) {
	console.error('error >', error)
	console.dir(error);
})

ES6 Promises

If you are unfamiliar with Promises, read up on these:

iOS Quirks

Promise.Resolves

{
  "carrierName": String,
  "countryCode": String,
  "mcc": String,
  "mnc": String,
  "allowsVOIP": Boolean,
}

Sadly there's nothing more we can get here.

Promise.Rejects

When using an emulator or a sim card does not exist.

Android Quirks

All permission dialogues are built into the Telephony function.

Promise.Resolves

When Permission is DENIED to READ_PHONE_STATE
{
	"countryCode": String,
	"simOperator": String,
	"carrierName": String,
	"callState": Number,
	"dataActivity": Number,
	"networkType": Number,
	"phoneType": Number,
	"simState": Number,
	"isNetworkRoaming": Boolean,
	"mcc": String,
	"mnc": String,
}
When Permission is GRANTED to READ_PHONE_STATE
{
	// START GRANTED PERMISSIONS
	"phoneNumber": String,
	"deviceId": String,
	"deviceSoftwareVersion": String,
	"simSerialNumber": String,
	"subscriberId": String,
	// END GRANTED PERMISSIONS
	"countryCode": String,
	"simOperator": String,
	"carrierName": String,
	"callState": Number,
	"dataActivity": Number,
	"networkType": Number,
	"phoneType": Number,
	"simState": Number,
	"isNetworkRoaming": Boolean,
	"mcc": String,
	"mnc": String,
}

Promise.Rejects

Never.

Demo

npm run setup
# iOS
npm run demo.ios
# Android
npm run demo.android

License

This plugin is licensed under the MITlicense by Rob Laverty

Keywords

NativeScript

FAQs

Package last updated on 26 Feb 2017

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