I want to write a service for Android platform that is notified when the current foreground activity changes.
Basically the service should do some tasks only when the top activity changes.
Is there any way to subscribe and to be notified when this kind of event occurs ?
Or there is no possibility and the service should poll from time to time the list of running activities and to check what is the foreground activity ?Not preferable solution...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…