Flav
Flav

Reputation: 237

How can I check if the Launcher/Home screen is currently displayed

I am working on a widget that is fetching and displaying some data. The refresh rate is custom.

What I would like to do, is only fetch data when the widget is displayed (when the launcher is on top).

Is there a way to check if the launcher is displayed?

Upvotes: 1

Views: 1154

Answers (1)

Falmarri
Falmarri

Reputation: 48577

There's almost certainly no way of doing this, unless of course the homescreen has some API for requesting this information. Your best bet is probably listening for screen turn ons/turnoffs.

But even so, just pick a conservative refresh rate and let your users modify it.

Upvotes: 1

Related Questions