如何在Android 10中打开活动(传入的voip呼叫) [英] How to open activity (incoming voip call) in Android 10

查看:341
本文介绍了如何在Android 10中打开活动(传入的voip呼叫)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 10中,对应用程序应用了新的限制. 我们不能再从后台开始活动了.虽然这对大多数应用程序来说可能很好,但这对于需要在推送通知到达后显示来电的voip应用程序是致命的打击.

In Android 10 there apply new restrictions for apps. We can no longer start an activity from background. While this may be fine for the majority of apps, it's a killing blow for voip-apps that need to show an incoming call after a push notification arrived.

根据此 https://developer.android.com/guide/components/activities/background-starts 列出了可以满足的条件,以便仍然允许他们开始一项活动,但是我对此并不完全理解(此处不是英语).

According to this https://developer.android.com/guide/components/activities/background-starts there is a list of conditions that can be met to still allow opening an activity, but tbh I do not understand that fully (non-english-native here).

我肯定知道的是:

  • 我没有任何正在运行的活动,任务,后退之类的东西

  • I do not have any running activity, task, backstack and the like

该应用程序尚未运行

我需要实现的目标:

  • 该应用程序的FCM服务接收到来自我们服务器的推送,并应显示来电屏幕(在锁定屏幕及所有屏幕上-就像在android 9及更低版本中一样)

我该怎么做才能在android 10中打开传入的voip呼叫的活动? 就像普通用户对PHONE应用程序所期望的那样,在锁定屏幕上以及所有内容上.

What can I do to open an activity for an incoming voip call in android 10? Over the lockscreen and all, just as a normal user would expect from a PHONE app.

预先感谢您的提示.

推荐答案

使用具有全屏意图"的高优先级通知.那会:

Use a high-priority notification with a "full-screen intent". That will:

  • 如果设备已锁定,则调用全屏意图"
  • 否则,显示提示"通知

这篇关于如何在Android 10中打开活动(传入的voip呼叫)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆