Hello, I'm trying to handle the following use case right after app installation: Display a microphone permission modal on the lock screen before answering an incoming call notification However, I've been searching for a way to show permission modals while the screen is locked, but I couldn't find any solution in other forums or documentation. I've also checked several calling apps, and it appears that none of them display permission modals either. Is this an OS specification/limitation? Are there any workarounds available?
Hello, I'm trying to handle the following use case right after app installation: Display a microphone permission modal on the lock screen before answering an incoming call notification However, I've been searching for a way to show permission modals while the screen is locked, but I couldn't find any solution in other forums or documentation. I've also checked several calling apps, and it appears that none of them display permission modals either.
Correct. What you're trying to do is not possible.
Is this an OS specification/limitation?
It's basically part of the system fundamental design. Your app is "given" access to the screen (for example, when you enter the foreground) and cannot "take" access on it's own. Things like permissions dialogs are actually a secondary side effect of that, as most of them require your app to have valid access to the screen before they'll present.
One CallKit specific detail that may be confusing you here. The "call UI" screen the system presents (what you use to answer calls, end calls, etc.) is NOT part of your app. It's and ENTIRELY separate application ("InCallService", if you're curious) that the system launches and then uses to handle calls. CallKit actually works by sending and receiving commands through callservicesd to InCallService.
Are there any workarounds available?
No, not really. The standard approach used by most voip apps is:
-
As for microphone authorization the first time the app launches and at any later point it realizes it's not authorized.
-
If a call arrives and the app is not microphone authorized, apps typically report a call to CallKit (as the API contract requires), end it immediately (so the user doesn't get stuck fumbling with a call that doesn't work), then post a local notification telling the user what the problem is (so they can foreground the app and fix it).
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware