开发者

Detect when a non-application Activity has been called

I am trying to use a theme tune throughout all my activities. From other Stack Overflow questions it has been suggested that a Service is the correct way to do this. In order to stop the theme tune from playing I need to detect when an activity is executed that isn't part of my app开发者_Python百科lication.

Is there any way to do this?


Can't you just use onPause() and onResume(), etc for all your activities and keep track of whether they're still being used or not and send a message to the service or something? I don't think you can tell when other apps are being used that elegantly but I may be very wrong...

There's also onAudioFocusChange(etc) which lets you detect if something else is trying to play music...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜