title: How to check if the application is foreground or background now?
body: <p>Capacitor provides an <a href="https://capacitor.ionicframework.com/docs/apis/app" rel="nofollow noreferrer">App</a> plugin that allows to <a href="https://capacitor.ionicframework.com/docs/apis/app#method-addListener-0" rel="nofollow noreferrer">get a call back</a> when the application goes background or foreground. But how to get the application <code>isActive</code> value (a.k.a. foreground/background state) at any moment? The problem is that I don't know the application state until I subscribe to the <code>appStateChange</code> event AND the app goes background or foreground.</p>