By using the Ionic 2 native Device plugin, you can easily retrieve the basic device information such as

1. cordova - The version of Cordova running on the device.
2. model - The device.model.
3. platform - The device’s operating system.
4. uuid - The device’s Universally Unique Identifier (UUID).
5. version - The operating system version.
6. manufacturer - The device’s manufacturer.
7. isVirtual - Whether the device is running on a simulator.
8. serial - The device hardware serial number.



First, create a new Ionic 2 project using

ionic start deviceinfo blank --v2

Then add the Device plugin using

cd deviceinfo
ionic plugin add cordova-plugin-device --save
npm install --save @ionic-native/device

Now import the Device class to the app.module.ts.

import { Device } from '@ionic-native/device';

Include the Device class in the provider.

providers: [Device,
SplashScreen,{provide: ErrorHandler, useClass: IonicErrorHandler}

Now import the Device class to the home.ts file.

import { Device } from '@ionic-native/device';

The Full Source code of home.ts.

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Device } from '@ionic-native/device';

selector: 'page-home',
templateUrl: 'home.html'

export class HomePage {

constructor(public navCtrl: NavController,private device: Device) {}

public getuid()

var items=[{key:'uuid',value: this.device.uuid},
{key:'model',value: this.device.model},
{key:'manufacturer',value: this.device.manufacturer},
{key:'version',value: this.device.version},
{key:'platform',value: this.device.platform}


Now add the below code in home.html.

<ion-list no-lines>
<button ion-item *ngFor="let item of items">
{{ item.key }} - {{item.value}}

<button ion-button color="danger" (click)="getuid()" > 
Get Device Info</button>

Whenever you click the button, the device information retrieved and displayed.

That's all. You are done. You can preview this Ionic 2 application in two ways. 
1. Generate APK( or iOS file) and install it in physical device or emulator
2. You can use the Ionic View mobile application 

Ionic view support only a few native plugins. You can visit the below link for more information about the Ionic view supported native plugins list.

Now generate the APK using the below command

ionic platform add android
ionic build android

Or run the APK in the Genymotion emulator using

ionic run android

Or run the application on iOS emulator using

ionic platform add ios
ionic run ios

To view your application in the Ionic view, you must upload it. To upload

ionic upload

The above command will ask username and password for account. After the successful upload, you can view the Ionic 2 application using the Ionic View Mobile application which will be installed on your device.

Below information is the Ionic framework version while writing this tutorial.

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.10.0
Xcode version: Xcode 8.2.1

Supported platforms

BlackBerry 10
Firefox OS
Windows Phone