0

I need to implement a feature, that will jump to custom view when phone rings. I had the following idea:

  • register a listener to listen phone ring
  • jump to custom view after 1s when phone ring has been detected

But it can't work well at some android version. Can you give me some ideas?

Sandeep
  • 455
  • 4
  • 26
Guokas
  • 750
  • 7
  • 23

1 Answers1

0

Android 8 added some actions related to this.

The ANSWER_PHONE_CALLS permission allows your app to answer incoming phone calls programmatically. To handle an incoming phone call in your app, you can use the acceptRingingCall() method. You could use this method to implement your custom view.

These permission are both classified as dangerous however and are both part of the PHONE permission group.

Josh
  • 386
  • 5
  • 14
  • Burton. thanks for your recommendation. but My test android version is 4.4,which I have to be compatible with it. – Guokas Sep 26 '18 at 08:18
  • Might want to check this out https://stackoverflow.com/questions/13395633/add-phonestatelistener – Josh Sep 26 '18 at 08:24