Git Product home page Git Product logo

cordova-plugin-uptime's Introduction

Cordova Uptime plugin

This plugin will return the device uptime that is not affected by changing the device date/time settings.

Installation

With cordova-cli

If you are using cordova-cli, install with:

cordova plugin add cordova-plugin-uptime

With plugman

With a plain plugman, you should be able to install with something like:

plugman --platform <ios|android> --project <directory> --plugin https://github.com/MartinDomig/cordova-plugin-uptime.git

Use from Javascript

The value returned is a string data type. In JavaScript, you might want to convert it to integer before using it for calculations.

cordova.getUptime(function (uptime) {
    console.log("uptime in milliseconds: " + parseInt(uptime));
});

Supported platforms

  • Android
  • iOS
  • Browser

Quirks

  • The return value is a string data type. This is because there is, as far as I know, no way to return a long value from an android cordova plugin. Please let me know if you know better.
  • Browser support is not system time independent. It doesn't return system uptime, but the time since the browser loaded the application.

## Credits

Written by Martin Domig

cordova-plugin-uptime's People

Contributors

martindomig avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.