How to go back to InCallUI when user hit the back button in LockTask mode?

1.2k views Asked by At

For one of my customer, I have an Android COSU app in LockTask mode.

On an incoming/outgoing call, the InCallUI is well displayed because the phone app of the device is whitelisted.

However, in LockTask mode, the back button is still enabled in the navigation bar and their employees (as good ones :)) often hit it so they cannot hang up the conversation.

My question is:

Does it exist an Intent to bring back the InCallUI so users can interact with the keypad or hang up?

In this case, I could display an overlay (bar on top of the screen or button like Facebook Messenger) to bring back the InCallUI.

Thanks in advance :)

[EDIT] Exiting the LockTask mode is not an option ;)

1

There are 1 answers

5
cuihtlauac On BEST ANSWER

Have you tried calling TelecomManager.showInCallScreen()? Its documentation says:

Requires that the method-caller be set as the system dialer app or have the READ_PHONE_STATE permission.

Since READ_PHONE_STATE is a dangerous permission, it might be granted to your COSU app. Then, per the second clause of the above quote, you should be able to expose a button bringing back the InCallService to the foreground.

I haven't tested this myself, let me know if it works.