开发者

Android - Bringing Activity to Foreground via the Call Button (Green Key)

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>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜