cordova-plugin
This plugin defines a global device
object, which describes the device's hardware and software.
Although the object is in the global scope, it is not available until after the deviceready
event.
Straight copy from apache cordova sample - used to extend
plugman install --platform android --project . --plugin @alschytte/cordova-mydevice
plugman uninstall --platform android --project .--plugin @alschytte/cordova-mydevice
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(mydevice.cordova);
}
Installation
cordova plugin add @alschytte/cordova-mydevice
Properties
- mydevice.cordova
- mydevice.model
- mydevice.platform
- mydevice.uuid
- mydevice.version
- mydevice.manufacturer
- mydevice.isVirtual
- mydevice.serial
mydevice.cordova
Get the version of Cordova running on the device.
mydevice.model
The mydevice.model
returns the name of the device's model or
product. The value is set by the device manufacturer and may be
different across versions of the same product.
Quick Example
var model = mydevice.model;
Quirks
- Gets the product name instead of the model name, which is often the production code name. For example, the Nexus One returns
Passion
, and Motorola Droid returnsvoles
.
mydevice.platform
Get the device's operating system name.
var string = mydevice.platform;
Quick Example
var devicePlatform = mydevice.platform;
mydevice.uuid
Get the device's Universally Unique Identifier (UUID).
var string = mydevice.uuid;
Description
The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.
Quick Example
var deviceID = mydevice.uuid;
mydevice.version
Get the operating system version.
var string = mydevice.version;
Quick Example
var deviceVersion = mydevice.version;
mydevice.manufacturer
Get the device's manufacturer.
var string = mydevice.manufacturer;
Quick Example
var deviceManufacturer = mydevice.manufacturer;
mydevice.isVirtual
whether the device is running on a simulator.
var isSim = mydevice.isVirtual;
mydevice.serial
Get the device hardware serial number (SERIAL).
var string = mydevice.serial;