Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...