New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

cordova-plugin-uptime

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-uptime

A Cordova plugin to retrieve the system uptime in milliseconds since boot.


Version published
Weekly downloads
36
decreased by-64.36%
Maintainers
1
Weekly downloads
 
Created

cordova-plugin-uptime

This plugin provides the system uptime in milliseconds since boot, allowing developers to track how long a device has been running. This can be particularly useful for monitoring, diagnostics, or adding uptime information within an application.

Installation

$ ionic cordova plugin add cordova-plugin-uptime
$ npm install --save @ionic-native/uptime

Supported Platforms

  • Android
  • iOS

Usage

Ionic Framework 2+ - TypeScript

import { Uptime } from '@ionic-native/uptime';  

constructor(private uptime: Uptime) { }  

// ...

this.uptime.getUptime(includeDeepSleep)
  .then((uptime) => console.log('Uptime (ms): ', uptime))
  .catch((error) => console.log('Error: ', error));

ES5 usage:

Uptime.getUptime(includeDeepSleep,
    function(uptime) { 
        console.log('Uptime (ms): ', uptime);
    },
    function(err) {  
        console.log('Error: ', err);
    }
);

The includeDeepSleep is a boolean parameter. If set to true, the returned uptime includes the total uptime (including device sleeping time). Otherwise, it will be the uptime considering clock stops when the system enters deep sleep (CPU off, display dark, device waiting for external input), but is not affected by clock scaling, idle, or other power-saving mechanisms.

Contributing

If you would like to contribute to this plugin, please feel free to submit a pull request or open an issue on our GitHub repository.

Author

This plugin is made with :heart: by Silviu Stroe

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

FAQs

Package last updated on 17 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts