I currently have an application that naturally gets pushed to the background when the home key is pressed.
The activity losses focus but continues running in the background.
So I want to know is it possible to bring the app开发者_运维问答lication back to the foreground when the user presses the green key (call button) on the device?
There is no way to completely override the call button behaviour without user interaction. When pressing it, the user will be asked to choose between the default action (launching the dialer), or launching your application.
If you wanted to do this, your manifest would look something like this:
<activity android:name=".SomeActivity">
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
精彩评论