0 Replies Latest reply on Oct 17, 2017 11:58 AM by martinr82627281

    Check the current battery status if it is plugged in or not

    martinr82627281

      I want to check if the device is plugged in or not with this plugin:

       

      phonegap-plugin-battery-status

       

      document.addEventListener("deviceready", onDeviceReady, false);

      function onDeviceReady() {

       

      navigator.getBattery().then(function(battery) {
        console
      .log("result: " + battery.charging);
        
      });

       

      }

       

      But the result is always TRUE, even if I unplug it.

      What could be the reason?