I want update an widget in android only when widget is visible on home screen, and don't want to update when :
1. screen is turned off
2. another app is running
3. widget is placed on another (invisible) home screen tab

how would i do that. I have searched on google and stackoverflow, but could not find proper solution.

Thanks in advance.