Android - 通过呼叫按钮(绿键)将 Activity 带到前台
我目前有一个应用程序,当按下主页键时,它会自然地被推送到后台。
该活动失去焦点,但继续在后台运行。
所以我想知道当用户按下设备上的绿色键(通话按钮)时是否可以将应用程序带回到前台?
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 application back to the foreground when the user presses the green key (call button) on the device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有用户交互,则无法完全覆盖呼叫按钮行为。按下它时,系统将要求用户在默认操作(启动拨号器)或启动应用程序之间进行选择。
如果您想这样做,您的清单将如下所示:
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: