Git Product home page Git Product logo

cordova-plugin-device-information's Introduction

Cordova Device Information

Cordova plugin to check all sorts of device information

Installation

Simply run

cordova plugin add https://github.com/quintenadema/cordova-plugin-device-information

Usage

Get device information

Usage:

const device = await deviceInformation.device();
console.log(device);

Example response:

{
	"device": [
		"model": "iPhone",
		"systemVersion": "17.0.2",
		"name": "iPhone"
	],
	"locale": [
		"locale": "en_NL",
		"preferredLanguages": [
			"nl-NL",
			"en-NL"
		]
	],
}

Get app information

Usage:

const app = await deviceInformation.app();
console.log(app);

Example response:

{
	"version": "3.0.13",
	"beta": true,
	"bundle": "com.ademagroup.moofer"
}

Get permissions

Usage:

const permissions = await deviceInformation.permissions();
console.log(permissions);

Example response:

{
	"location": "authorizedAlways", // iOS only
	"location": "authorizedWhenInUse", // iOS only
	"location": "authorizedFine", // Android only
	"location": "authorizedCoarse", // Android only

	"backgroundLocation": "authorized", // Android only
	
	"camera": "notAuthorized",
	"contacts": "notAuthorized",
	"microphone": "notAuthorized",
	"photos": "notAuthorized",
	
	"calendar": "notAuthorized",
	"reminders": "notAuthorized" // iOS only
	
	"mediaLibrary": "notAuthorized", // iOS only
}

Get network information

Usage:

const network = await deviceInformation.network();
console.log(network);

Example response:

{
	"carrier": "--",
	"countryCode": "65535"
}

Get disk information

Usage:

const disk = await deviceInformation.disk();
console.log(disk);

Example response:

{
	"freeSpace": 59762274304 // bytes
}

Get battery information

Usage:

const battery = await deviceInformation.battery();
console.log(battery);

Example response:

{
	"batteryCharge": 60,
	"batteryState": "charging"
}

Get jailbreak information

Usage:

const jailbreak = await deviceInformation.jailbreak();
console.log(jailbreak);

Example response:

{
	"isJailbroken": true
}

Set callback

Usage:

deviceInformation.setCallback('onBattery', function(battery) {
	console.log(battery);
});

cordova-plugin-device-information's People

Contributors

quintenadema avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.