开发者

Android: how to have my app open automatically?

开发者 https://www.devze.com 2023-03-13 08:57 出处:网络
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 k

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.

0

精彩评论

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

关注公众号