简体   繁体   English

如何检查小部件主屏幕

[英]How to check for widget Home screen

I want to check whether user is facing the widget Homescreen(ie where the widget are placed) or using some other screen .ie he may be playing game or texting or something else..If user is on some other screen i don't want execute my code.. 我想检查用户是面向小部件主屏幕(即放置小部件的位置)还是正在使用其他屏幕,即他可能正在玩游戏或发短信或其他东西。如果用户位于其他屏幕上,我不想执行我的代码..

For instance a clock widget doesn't need to run once a minute if it's not visible on the screen. 例如,如果时钟小部件在屏幕上不可见,则不必每分钟运行一次。 In order to cut down on battery drain it would be really nice if home screen widgets could be informed of their visibility 为了减少电池消耗,如果可以告知主屏幕小部件可见性,那将非常好

This is not possible in any reliable fashion. 这不可能以任何可靠的方式进行。 There is a long-standing issue to provide some ability to do this. 提供这样做的能力是一个长期存在的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM