How to open activity (incoming voip call) in Android 10

蓝咒 提交于 2019-12-18 09:14:44

问题


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.

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).

What I definitely know, is:

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

  • The app is NOT EVEN RUNNING

What I need to achieve:

  • The FCM service of the app receives a push from our server and shall present the incoming call screen (over lock screen and all - just as it did with android 9 and below)

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.

Thanks in advance for any hints.


回答1:


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

  • Invoke your "full-screen intent" if the device is locked
  • Otherwise, display a "heads-up" notification


来源:https://stackoverflow.com/questions/58819246/how-to-open-activity-incoming-voip-call-in-android-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!