2017-03-20 16:38:14 -04:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { CordovaProperty, Plugin } from '@ionic-native/core';
|
2016-07-08 00:51:45 +02:00
|
|
|
|
2016-12-04 11:42:30 -05:00
|
|
|
declare var window: any;
|
2015-11-29 17:20:11 -06:00
|
|
|
|
2016-01-25 16:20:36 -06:00
|
|
|
/**
|
2016-02-22 16:20:00 -05:00
|
|
|
* @name Device
|
|
|
|
|
* @description
|
2016-01-25 16:20:36 -06:00
|
|
|
* Access information about the underlying device and platform.
|
|
|
|
|
*
|
|
|
|
|
* @usage
|
2016-07-20 17:17:09 +02:00
|
|
|
* ```typescript
|
2017-03-20 16:38:14 -04:00
|
|
|
* import { Device } from '@ionic-native/device';
|
2016-03-24 13:00:18 -04:00
|
|
|
*
|
2017-03-20 16:38:14 -04:00
|
|
|
* constructor(private device: Device) { }
|
2016-03-24 13:00:18 -04:00
|
|
|
*
|
2017-03-20 16:38:14 -04:00
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* console.log('Device UUID is: ' + this.device.uuid);
|
2016-01-25 16:20:36 -06:00
|
|
|
* ```
|
|
|
|
|
*/
|
2015-11-29 17:20:11 -06:00
|
|
|
@Plugin({
|
2016-10-27 12:48:50 -05:00
|
|
|
pluginName: 'Device',
|
2015-11-29 17:20:11 -06:00
|
|
|
plugin: 'cordova-plugin-device',
|
2016-02-22 16:20:00 -05:00
|
|
|
pluginRef: 'device',
|
2017-03-28 08:24:04 -04:00
|
|
|
repo: 'https://github.com/apache/cordova-plugin-device',
|
|
|
|
|
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
|
2015-11-29 17:20:11 -06:00
|
|
|
})
|
2017-03-20 16:38:14 -04:00
|
|
|
@Injectable()
|
2015-11-29 17:20:11 -06:00
|
|
|
export class Device {
|
2016-01-25 16:20:36 -06:00
|
|
|
|
2016-12-06 07:33:08 -05:00
|
|
|
/** Get the version of Cordova running on the device. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
cordova: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
2016-04-29 23:56:49 -04:00
|
|
|
/**
|
2016-12-06 07:33:08 -05:00
|
|
|
* The device.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.
|
2016-04-29 23:56:49 -04:00
|
|
|
*/
|
2016-03-04 13:56:22 -06:00
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
model: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Get the device's operating system name. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
platform: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Get the device's Universally Unique Identifier (UUID). */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
uuid: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Get the operating system version. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
version: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Get the device's manufacturer. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
manufacturer: string;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Whether the device is running on a simulator. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
isVirtual: boolean;
|
2016-12-06 07:33:08 -05:00
|
|
|
|
|
|
|
|
/** Get the device hardware serial number. */
|
|
|
|
|
@CordovaProperty
|
2017-03-20 16:38:14 -04:00
|
|
|
serial: string;
|
2016-07-20 17:17:09 +02:00
|
|
|
|
2015-11-29 17:20:11 -06:00
|
|
|
}
|