intercept the Android's OS incoming call screen and replace

前端 未结 3 1860
[愿得一人]
[愿得一人] 2021-02-02 14:29

I would like to intercept the Android\'s OS incoming call screen and replace it with my app\'s incoming call screen. However, there is no API to do so, but I know for sure it is

相关标签:
3条回答
  • 2021-02-02 14:52

    I guess you might have done 95% of the work. The problem of your screen not showing up but the system incoming call could be solved like this :

    Can an activity receive an unordered broadcast(incoming call) intent before system's default receiver?

    0 讨论(0)
  • 2021-02-02 14:54

    You will have to overlay the native screen with a control(maybe a dialog box) when you get android.intent.action.PHONE_STATE as ringing.

    You have to register a BroadcastReceiver for the action android.intent.action.PHONE_STATE.

    The receiving intent will have a variable TelephonyManager.EXTRA_STATE_RINGING which will have the current state.

    Let me know!

    0 讨论(0)
  • 2021-02-02 15:00

    You need to intercept broadcast android.intent.action.PHONE_STATE with highest possible priority, then if in your BroadcastReceiver.onReceive() you will cancel broadcast through BroadcastReceiver.abortBroadcast() you will be able to stop default incoming call screen to be shown, since default application won't receive incoming call broadcast. After that you're free to show your own Activity.

    At least the same strategy works with incoming SMS' - I used to do as described above.

    0 讨论(0)
提交回复
热议问题