I have an app and a music in all activity of my app I would like that, when user press button home, the sound stops like all game that you can download from android market.
How I can do that?
When user press home button a new intent is fired but android framework prevents to catch the main intent so I can't use a broadcast receiver with this action
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
One solution is to stop music onPause and I restart onResume but in this solution the user hear a second pause when switching from one activity to the next, is not good I search this solution on many forum but unsuccessfully
P.S.
- the android framework don't allow to catch the home key onKeyDown event
- the android framework don't allow to catch the intent launched when user press on home button