Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-dna-deviceinfo

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-dna-deviceinfo - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

platforms/ios/app.entitlements

1

deviceinfo.android.d.ts

@@ -25,2 +25,3 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static storageVolumes(): StorageVolume[];
static wifiSSID(): string;
static isTablet(): boolean;

@@ -27,0 +28,0 @@ static is24Hour(): boolean;

@@ -253,2 +253,26 @@ "use strict";

};
DeviceInfo.wifiSSID = function () {
var ctx = application_1.android.context;
var permission = android.Manifest.permission;
var contextCompat = android.support.v4.content.ContextCompat;
var PackageManager = android.content.pm.PackageManager;
var permissionCL = permission.ACCESS_COARSE_LOCATION;
var permissionStatusCL = contextCompat.checkSelfPermission(ctx, permissionCL);
var permissionPresentForCL = permissionStatusCL === PackageManager.PERMISSION_GRANTED;
var permissionFL = permission.ACCESS_FINE_LOCATION;
var permissionStatusFL = contextCompat.checkSelfPermission(ctx, permissionFL);
var permissionPresentForFL = permissionStatusFL === PackageManager.PERMISSION_GRANTED;
var permissionWS = permission.ACCESS_WIFI_STATE;
var permissionStatusWS = contextCompat.checkSelfPermission(ctx, permissionWS);
var permissionPresentForWS = permissionStatusWS === PackageManager.PERMISSION_GRANTED;
var permissionPresent = ((permissionPresentForCL || permissionPresentForFL) && permissionPresentForWS);
if (permissionPresent) {
var ws = ctx.getSystemService(Context.WIFI_SERVICE);
var wifiInfo = ws.getConnectionInfo();
if (wifiInfo.getSupplicantState() === android.net.wifi.SupplicantState.COMPLETED) {
return wifiInfo.getSSID();
}
}
return "";
};
DeviceInfo.isTablet = function () {

@@ -255,0 +279,0 @@ var Configuration = android.content.res.Configuration;

@@ -46,2 +46,3 @@ import { RadioAccessTechnology, WCTGeneration } from "./index.d";

storageVolumes(): StorageVolume[];
wifiSSID(): string;
isTablet(): boolean;

@@ -48,0 +49,0 @@ is24Hour(): boolean;

@@ -27,2 +27,3 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static storageVolumes(): StorageVolume[];
static wifiSSID(): string;
static isTablet(): boolean;

@@ -29,0 +30,0 @@ static is24Hour(): boolean;

@@ -164,2 +164,13 @@ "use strict";

};
DeviceInfo.wifiSSID = function () {
var interfaces = CNCopySupportedInterfaces();
if (interfaces.count) {
var interfaceName = CFArrayGetValueAtIndex(interfaces, 0);
var dict = CNCopyCurrentNetworkInfo(interfaceName);
if (dict !== null && dict.count) {
return dict.objectForKey(kCNNetworkInfoKeySSID);
}
}
return "";
};
DeviceInfo.isTablet = function () {

@@ -166,0 +177,0 @@ return UIDevice.currentDevice.userInterfaceIdiom === 1;

@@ -53,2 +53,3 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static storageVolumes(): StorageVolume[];
static wifiSSID(): string;
static isTablet(): boolean;

@@ -55,0 +56,0 @@ static is24Hour(): boolean;

16

package.json
{
"name": "nativescript-dna-deviceinfo",
"version": "2.0.0",
"version": "2.1.0",
"description": "NativeScript plugin to acquire device information.",

@@ -67,3 +67,6 @@ "main": "deviceinfo",

"USB On The Go",
"External Storage Card"
"External Storage Card",
"WiFi",
"SSID",
"WiFi SSID"
],

@@ -81,9 +84,10 @@ "author": {

"devDependencies": {
"nativescript-custom-entitlements": "^0.2.0",
"prompt": "^1.0.0",
"rimraf": "^2.6.3",
"semver": "^5.6.0",
"tns-core-modules": "^5.0.0",
"tns-platform-declarations": "^5.0.0",
"typescript": "~3.3.3",
"prompt": "^1.0.0",
"rimraf": "^2.6.3",
"tslint": "^5.12.1",
"semver": "^5.6.0"
"typescript": "~3.3.3"
},

@@ -90,0 +94,0 @@ "dependencies": {},

@@ -11,3 +11,3 @@

- Cross-platform APIs for Android and iOS.
- Cross-platform APIs for Android and iOS to retrieve or query device related information.
- Offers APIs to obtain device related info.

@@ -26,2 +26,3 @@

- 2.0.0: Changed APIs name for storageVolumes & cellularServiceProviders.
- 2.1.0: Added API to get service set identifier(SSID) of a wireless local area network (WLAN).

@@ -103,3 +104,3 @@ ## Installation

- Note for Android users:
- Notes for Android users:
* Permission BLUETOOTH is needed.

@@ -187,34 +188,2 @@

### - isTablet
Returns 'true' if a device is a tablet, otherwise 'false'.
```javascript
DeviceInfo.isTablet();
```
### - is24Hour
Returns 'true' if a device configured to a 24-hour clock, otherwise 'false'.
```javascript
DeviceInfo.is24Hour();
```
### - isEmulator
Returns 'true' if an app is running on an emulator, otherwise 'false'.
```javascript
DeviceInfo.isEmulator();
```
### - isBatteryCharging
Returns 'true' if a device is plugged in and charging, otherwise 'false'.
```javascript
DeviceInfo.isBatteryCharging();
```
### - cellularServiceProviders

@@ -247,3 +216,3 @@

- Note for Android users:
- Notes for Android users:
* If the **targetSdkVersion is 17**, a device with dual sim, the API returns an "active" carrier. Permission ACCESS_COARSE_LOCATION is needed.

@@ -286,3 +255,72 @@ * If the **targetSdkVersion is >= 22**, a device with dual sim, the API returns both the carriers. Permission READ_PHONE_STATE is needed. To know more about the request permissions process, please visit the link [Request App Permissions](https://developer.android.com/training/permissions/requesting).

### - wifiSSID
Returns service set identifier(SSID) of a wireless local area network (WLAN). In the absence of right permissions, returns an empty string.
```javascript
DeviceInfo.wifiSSID();
```
- Notes for Android users:
* Permissions ACCESS_WIFI_STATE and ACCESS_FINE_LOCATION/ACCESS_COARSE_LOCATION are required.
* Android version 9 (Pie) requires location service in enabled(ON) state alongside above-said permissions.
* To know more about the request permissions process, please visit the link [Request App Permissions](https://developer.android.com/training/permissions/requesting).
- Notes for iOS users:
* To use this API on iOS 12 and later, enable the Access WiFi Information.
* To use this API on iOS 13 and later, enable the Access WiFi Information, and
* must also meet at least one of criteria below
* Apps with permission to access location
* Currently enabled VPN app
* NEHotspotConfiguration (only Wi-Fi networks that the app configured)
* Kindly visit the link [Access WiFi Information](https://developer.apple.com/account/ios/identifier/bundle) to enable it for your app with the id "nativescript.id" in package.json.
* Also, add this to your App_Resources/iOS/app.entitlements (mind the name!) file:
```xml
<key>com.apple.developer.networking.wifi-info</key>
<true/>```
* The demo app has this:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/ PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
</dict>
</plist>
```
### - isTablet
Returns 'true' if a device is a tablet, otherwise 'false'.
```javascript
DeviceInfo.isTablet();
```
### - is24Hour
Returns 'true' if a device configured to a 24-hour clock, otherwise 'false'.
```javascript
DeviceInfo.is24Hour();
```
### - isEmulator
Returns 'true' if an app is running on an emulator, otherwise 'false'.
```javascript
DeviceInfo.isEmulator();
```
### - isBatteryCharging
Returns 'true' if a device is plugged in and charging, otherwise 'false'.
```javascript
DeviceInfo.isBatteryCharging();
```
## APIs in Action

@@ -310,2 +348,3 @@

console.log("Storage Volume Info: ", DeviceInfo.storageVolumes());
console.log("WiFi SSID: ", DeviceInfo.wifiSSID());
console.log("Is tablet: ", DeviceInfo.isTablet());

@@ -312,0 +351,0 @@ console.log("Is 24 hour: ", DeviceInfo.is24Hour());

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc