Basically I want my app to start running in the background when the ACTION_MEDIA_BUTTON is clicked. I've seen other apps do this, so it must be possible. I just don't know how it is possible. Some kind of special manifest code?
Currently my app can receive intents from the ACTION_MEDIA_BUTTON when it has been opened (and even running in the background) via intentfilter that I register in Java code of the main activity (when the app is first opened). But how would I have this b开发者_Go百科utton just... open up the app?
For reference, the following app can already do this functionality: https://market.android.com/details?id=com.kober.headset
Much appreciated, thanks.
Use a BroadcastReceiver
and register for the intent. See this Android Developers Blog post for more details.
精彩评论