---
title: "Cordova – Displaying Device Info"  
description: "When you are building an app that demands to check the information about the device, then you can integrate this plugin and make your work doneThis pl"  
author: "Anonymous User"  
published: 2017-04-20  
updated: 2018-03-19  
canonical: https://www.mindstick.com/blog/11359/cordova-displaying-device-info  
category: "apache cordova"  
tags: ["mobile development", "apache", "cordova"]  
reading_time: 2 minutes  

---

# Cordova – Displaying Device Info

When you are [building](https://www.mindstick.com/blog/23088/which-tonewood-is-suitable-for-building-a-guitar) an app that demands to check the information about the device, then you can integrate this plugin and make your work done

**This plugin can be used for getting information about the users device.**

**Step 1 - Installing Device Plugin**

To [install](https://www.mindstick.com/articles/12876/the-top-5-reasons-to-buy-and-install-a-tonneau-cover) this plugin, open **[command prompt](https://answers.mindstick.com/qa/51716/how-to-make-bootable-pendrive-using-cmd-windows-command-prompt)** window and run the following piece of code.

```
C:\Users\username\Desktop\CordovaProject>cordova plugin add cordova-plugin-device
```

**Step 2 - Add Button**

You can use this plugin in the same way you used the other Cordova [plugins](https://www.mindstick.com/articles/65049/5-wordpress-plugins-to-help-you-amplify-your-seo-efforts). Add button in **index.html** file. This button will be used for fetching info about the user’s device.

```
<button id = "DeviceInfo">GET INFO</button>
```

**Step 3 - Adding [Event Listener](https://www.mindstick.com/interview/529/how-to-remove-the-event-listener)**

Cordova plugins are available after the **deviceready** event so event listener will be [placed inside](https://www.mindstick.com/forum/12672/binding-all-college-names-to-a-college-dropdownlist-based-on-data-selected-in-another-city-dropdownlist-both-dropdownlists-are-placed-inside-the-datalist) onDeviceReady [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) in index.js file.

```
document.getElementById("DeviceInfo").addEventListener("click", DeviceInfo);   
```

**Step 4 - Creating Function**

The function below should be placed in **index.js** file. It will show you how to use all [capabilities](https://www.mindstick.com/interview/490/explain-the-concepts-and-capabilities-of-assembly-in-dot-net) the plugin provides.

```
function DeviceInfo() {
   alert("Cordova version: " + device.cordova + "\n" +      "Device model: " + device.model + "\n" +      "Device platform: " + device.platform + "\n" +      "Device UUID: " + device.uuid + "\n" +      "Device version: " + device.version);
} 
```

When we click **GET INFO** button, the alert will display us Cordova [version](https://www.mindstick.com/articles/12845/things-to-remember-while-migrating-odoo-to-a-better-version), device model, [platform](https://www.mindstick.com/articles/13080/wikipedia-the-most-powerful-advertising-platform-of-the-digital-age), UUID and device version of the user’s device.

![Cordova – Displaying Device Info](https://www.mindstick.com/blogs/ac25ead4-e92a-407e-ab1f-ee677b8610c7/images/95720628-df20-4669-a746-45aed4de5360.png)\

---

Original Source: https://www.mindstick.com/blog/11359/cordova-displaying-device-info

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
