npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capawesome/capacitor-device-info

v0.1.1

Published

Capacitor plugin to read device information on Android, iOS, and Web.

Readme

Capacitor Device Info Plugin

Capacitor plugin to read device information, such as the model, manufacturer, operating system, memory, and a per-install identifier.

Features

  • 🆔 Identifier: Read a unique per-install identifier for the device.
  • 📱 Information: Read the model, manufacturer, operating system, and more.
  • 🧠 Memory: Read the total memory of the device and the memory used by the app.
  • ⏱️ Uptime: Read how long the device has been running since its last boot.
  • 🖥️ Cross-platform: Support for Android, iOS, and Web.
  • 📦 CocoaPods & SPM: Supports CocoaPods and Swift Package Manager for iOS.
  • 🔁 Up-to-date: Always supports the latest Capacitor version.
  • 🤝 Compatibility: Works alongside the Battery and Localization plugins.

Missing a feature? Just open an issue and we'll take a look!

Use Cases

The Device Info plugin is typically used whenever an app needs to know more about the device it is running on, for example:

  • Bug reports and support: Attach the device model, manufacturer, operating system version, and WebView version to support tickets or crash reports.
  • Device registration: Use the per-install identifier to register a device on your backend without collecting personal data.
  • Adaptive user interfaces: Adjust your layout based on the device type, for example phone versus tablet.
  • Feature gating: Enable or disable features depending on the Android SDK version or the major iOS version.
  • Diagnostics: Monitor the memory used by your app or detect whether it is running on an emulator or simulator.

Compatibility

| Plugin Version | Capacitor Version | Status | | -------------- | ----------------- | -------------- | | 0.x.x | >=8.x.x | Active support |

Installation

You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:

npx skills add capawesome-team/skills --skill capacitor-plugins

Then use the following prompt:

 Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-device-info` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capawesome/capacitor-device-info
npx cap sync

No additional permissions or configuration are required on any platform.

Configuration

No configuration required for this plugin.

Usage

The following examples show how to read the device identifier, read device information, and read the device uptime.

Read the device identifier

Get a unique per-install identifier for the device, for example to register the device on your backend. See the API documentation for when the identifier is reset on each platform:

import { DeviceInfo } from '@capawesome/capacitor-device-info';

const getId = async () => {
  const { identifier } = await DeviceInfo.getId();
  return identifier;
};

Read device information

Get information about the device, such as the model, manufacturer, operating system, device type, and memory. Fields that a platform cannot determine are null (see Platform Support):

import { DeviceInfo } from '@capawesome/capacitor-device-info';

const getInfo = async () => {
  const info = await DeviceInfo.getInfo();
  return info;
};

Read the device uptime

Get the time the device has been running since its last boot, in milliseconds. Only available on Android and iOS:

import { DeviceInfo } from '@capawesome/capacitor-device-info';

const getUptime = async () => {
  const { uptime } = await DeviceInfo.getUptime();
  return uptime;
};

API

getId()

getId() => Promise<GetIdResult>

Get a unique identifier for the device.

On Android, the identifier is the ANDROID_ID value, which is unique per app-signing key, user, and device. It is reset when the app is reinstalled after the signing key changes or the device is factory reset.

On iOS, the identifier is the identifierForVendor value, which is unique per vendor and device. It is reset when all apps from the vendor are uninstalled.

On Web, the identifier is a random UUID that is persisted in the browser's localStorage. It is reset when the browser storage is cleared.

Returns: Promise<GetIdResult>

Since: 0.1.0


getInfo()

getInfo() => Promise<GetInfoResult>

Get information about the device.

Returns: Promise<GetInfoResult>

Since: 0.1.0


getUptime()

getUptime() => Promise<GetUptimeResult>

Get the time the device has been running since its last boot, in milliseconds.

Only available on Android and iOS.

Returns: Promise<GetUptimeResult>

Since: 0.1.0


Interfaces

GetIdResult

| Prop | Type | Description | Since | | ---------------- | ------------------- | ------------------------------------ | ----- | | identifier | string | The unique identifier of the device. | 0.1.0 |

GetInfoResult

| Prop | Type | Description | Since | | ----------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | | androidSdkVersion | number | null | The Android SDK version number (API level). Returns null on platforms other than Android. Only available on Android. | 0.1.0 | | deviceType | DeviceType | The type of the device. | 0.1.0 | | iosVersion | number | null | The major version number of iOS. Returns null on platforms other than iOS. Only available on iOS. | 0.1.0 | | isVirtual | boolean | Whether the app is running on a virtual device (simulator or emulator). | 0.1.0 | | manufacturer | string | The manufacturer of the device. | 0.1.0 | | model | string | The model identifier of the device. On iOS, this is the internal model identifier (e.g. iPhone13,4), not the marketing name. | 0.1.0 | | name | string | null | The name of the device. On iOS 16 and newer, a generic device name (e.g. iPhone) is returned unless the app has the required entitlement. Returns null if the name cannot be determined. | 0.1.0 | | operatingSystem | OperatingSystem | The operating system of the device. | 0.1.0 | | osVersion | string | The version of the operating system. | 0.1.0 | | platform | Platform | The platform the app is running on. | 0.1.0 | | totalMemory | number | null | The total amount of memory of the device, in bytes. Returns null if the total memory cannot be determined. Only available on Android and iOS. | 0.1.0 | | usedMemory | number | null | The amount of memory used by the app, in bytes. Returns null if the used memory cannot be determined. Only available on Android and iOS. | 0.1.0 | | webViewVersion | string | null | The version of the WebView that renders the app. On iOS, the version of the operating system is returned, because the WebKit version is tied to it. Returns null if the WebView version cannot be determined. | 0.1.0 |

GetUptimeResult

| Prop | Type | Description | Since | | ------------ | ------------------- | -------------------------------------------------------------------------- | ----- | | uptime | number | The time the device has been running since its last boot, in milliseconds. | 0.1.0 |

Type Aliases

DeviceType

The type of a device.

  • phone: A handheld phone-sized device.
  • tablet: A tablet-sized device.
  • desktop: A desktop or laptop computer.
  • tv: A television or set-top box.
  • unknown: The type could not be determined.

'phone' | 'tablet' | 'desktop' | 'tv' | 'unknown'

OperatingSystem

The operating system of a device.

'android' | 'ios' | 'windows' | 'mac' | 'unknown'

Platform

The platform an app is running on.

'android' | 'ios' | 'web'

Platform Support

The plugin returns null for any field that a platform cannot determine. The following table shows which fields of the getInfo() result are available on each platform:

| Property | Android | iOS | Web | | ------------------- | ------- | --- | ---------------- | | androidSdkVersion | ✅ | ❌ | ❌ | | deviceType | ✅ | ✅ | ✅ (best-effort) | | iosVersion | ❌ | ✅ | ❌ | | isVirtual | ✅ | ✅ | ✅ | | manufacturer | ✅ | ✅ | ❌ | | model | ✅ | ✅ | ✅ (best-effort) | | name | ✅ | ✅ | ❌ | | operatingSystem | ✅ | ✅ | ✅ (best-effort) | | osVersion | ✅ | ✅ | ✅ (best-effort) | | platform | ✅ | ✅ | ✅ | | totalMemory | ✅ | ✅ | ❌ | | usedMemory | ✅ | ✅ | ❌ | | webViewVersion | ✅ | ✅ | ✅ (best-effort) |

The getUptime() method is only available on Android and iOS.

Migration from @capacitor/device

This plugin can be used as a replacement for the official @capacitor/device plugin. The following table shows how the methods map:

| @capacitor/device | @capawesome/capacitor-device-info | | ------------------- | -------------------------------------------------------------------------------------- | | getId() | getId() | | getInfo() | getInfo() | | getBatteryInfo() | Use the Battery plugin | | getLanguageCode() | Use the Localization plugin | | getLanguageTag() | Use the Localization plugin |

FAQ

How is this plugin different from other similar plugins?

It gathers a wide range of device details through one fully typed API — model, manufacturer, operating system, a per-install identifier, total and used memory, device type, virtual-device detection, WebView version, and uptime — with consistent behavior across Android, iOS, and the Web. Fields a platform cannot determine are returned as null, and the package is actively maintained against the latest Capacitor and OS versions. If you only need the platform name, a minimal setup is enough; if you want a complete, honest picture of the device, this plugin is built for exactly that.

How stable is the identifier returned by getId?

The identifier is unique per install. On Android, it is the ANDROID_ID value, which is reset when the app is reinstalled after the signing key changes or the device is factory reset. On iOS, it is the identifierForVendor value, which is reset when all apps from the vendor are uninstalled. On the Web, it is a random UUID persisted in the browser's localStorage, which is reset when the browser storage is cleared.

Can this plugin replace the official @capacitor/device plugin?

Yes, this plugin can be used as a replacement for the official @capacitor/device plugin. The getId() and getInfo() methods map directly, while battery information and language settings are covered by the Battery and Localization plugins. See the migration table above.

Why is the device name always a generic value like iPhone on iOS?

On iOS 16 and newer, a generic device name is returned unless the app has the required entitlement from Apple. If the name cannot be determined at all, the name property is null.

Why are some fields null on my platform?

The plugin returns null for any field that a platform cannot determine. For example, totalMemory and usedMemory are only available on Android and iOS, and androidSdkVersion is only available on Android. See the Platform Support section for a complete overview.

Can I get the battery level or the device language with this plugin?

No, this plugin focuses on device information such as the model, manufacturer, operating system, and memory. For battery information, use the Battery plugin. For the user's language and locale preferences, use the Localization plugin.

Can I use this plugin with Ionic, React, Vue or Angular?

Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.

Related Plugins

  • Battery: Access battery information.
  • Localization: Read the user's localization preferences, such as preferred locales and time zone.
  • Network: Access network information.

Newsletter

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.

Changelog

See CHANGELOG.md.

License

See LICENSE.