使用主页按钮退出时如何恢复操作?

发布于 2024-11-06 08:21:54 字数 363 浏览 5 评论 0原文

我正在开发一个 SIP 应用程序。我有一个小问题:当使用主页按钮“减少”应用程序并且我拨打电话时,我有编码的铃声来电,但应用程序不显示。如何在来电时弹出所有应用程序UI? 感谢您的帮助。 编辑:

public class IncomingCallReceiver extends BroadcastReceiver {



    @Override
    public void onReceive(Context context, Intent intent) {

        Dialog dialog = new Dialog(context,intent);
        dialog.répondre();
        }


}

I'm developping a SIP application. I have a little problem: when "reducing" the application with home button and i make a call to the phone, i have the coded ringing incoming call but the application doesn't shows. How to pops up all the application UI when having an incoming call ?
Thank you for your help.
EDIT:

public class IncomingCallReceiver extends BroadcastReceiver {



    @Override
    public void onReceive(Context context, Intent intent) {

        Dialog dialog = new Dialog(context,intent);
        dialog.répondre();
        }


}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏日浅笑〃 2024-11-13 08:21:54

因此,您有一个已停止的 Activity,并且您希望在来电时弹出它。我建议的方法:

  • 最初使用标志 FLAG_ACTIVITY_SINGLE_TOP
  • 覆盖该 Activity 中的 onNewIntent() 函数启动该 Activity,并根据 Intent 中的操作代码处理传入的 Intent(您定义它们以区分弹出的原因),
  • 当您想要将该 Activity 移动到前台时再次,使用一些操作代码调用 startActivity() (您也可以从服务中调用)。如果 Activity 没有启动,它就会启动。如果它启动了,它不会重新启动,而是恢复,您将在 onNewIntent() 中收到您的 Intent,并且您的 Activity 将被移至前台。

更新:

onNewIntent() 处理示例:

\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\app\SearchQueryResults.java

So, you have an Activity that is stopped and you want to pop it up when call arrives. Approach I would suggest:

  • originally start that Activity with flag FLAG_ACTIVITY_SINGLE_TOP
  • override function onNewIntent() in that Activity and process incoming Intent depending on action code from Intent (you define them to distinguish reasons for popping up)
  • when you want to move that Activity to foreground again, call startActivity() with some action code (you can to that from Service as well). If Activity is not started, it will be. If it is started, it will not be re-started but resumed and you will receive your Intent in onNewIntent() and your Activity will be moved to foreground.

UPDATE:

onNewIntent() handling example:

\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\app\SearchQueryResults.java

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文