[maemo-developers] Optimal battery life considerations in apps
From: Andrew Flegg andrew at bleb.orgDate: Fri Jul 24 11:54:06 EEST 2009
- Previous message: Re: Optimal battery life considerations in apps
- Next message: Optimal battery life considerations in apps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jul 24, 2009 at 07:55, daniel wilms<daniel.wilms at nokia.com> wrote: > > there is an API to detect if the window is in the foreground or not (thx to Kimmo > for pointing me to this) [1]. If this property is true, then the window is visible > on the screen. You can use this parameter directly from your root window. And here > [2] you find the method to get the value of the parameter. Yup, indeed. (PyMaemo doesn't expose the method, but you can get the property). However, what's the best way of detecting when you come *back* to the foreground? I didn't get a property-change event (although this could be due to a PyMaemo bug rather than a Hildon one). My basic code structure is: * while timer fires: - check is-topmost - if false, cancel timer and return - update screen * when receiving focus-in event: - check is-topmost - if true, re-initialise timer * when osso signal for power state received: - cancel, or re-initialise, timer as appropriate This works fine on Diablo (can't test on Fremantle due to no app switching). The "focus-in" bit seems a bit hacky, though. But if there's no better way which the Hildon developers/Nokia recommend, that's fine by me. Cheers, Andrew -- Andrew Flegg -- mailto:andrew at bleb.org | http://www.bleb.org/ Maemo Community Council chair
- Previous message: Re: Optimal battery life considerations in apps
- Next message: Optimal battery life considerations in apps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]