apache / cordova-plugin-battery-status

Apache Cordova Battery Status Plugin

Home Page:https://cordova.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Determine which event is fired

vienom opened this issue · comments

I want to check when the device is plugged in. Is there a way to check if the fired event is because of a level change or the plugging in?

I assume you listen to the batterystatus event? You can always evaluate the isPlugged property. If you store the "old" status and compare it to the new one you should be able to determine if the event was fired because of a level change or the plugging in/out of the charger.