I load the account addresses like this:
and I load the balances using this function:
Obviously, while using my DApp the user's account balance can change. Whenever the use of my DApp changes the balance, I update it by calling getBalance(...). However, this is not a complete solution because the balance may change if the user does anything outside my DApp.
Right now I'm polling the getBalance function every x seconds to keep the account balance reasonably up-to-date. Polling is not the cleanest solution because it constantly takes some power and some CPU cycles. If I save some power by only polling once a minute, it's very slow. Is there a way to avoid polling and just receive a callback when the account balance changes?