Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to intercept "Messages" sent from CallKit incoming call screen?

Tags:

ios

ios10

callkit

I'm using iOS 10's CallKit to receive incoming calls. The calls in my app do not come from "phone numbers" or "email addresses", but from an internal identifier in my protocol. I thus report incoming calls with the CXHandleType of CXHandleTypeGeneric (and not CXHandleTypePhoneNumber or CXHandleTypeEmailAddress), using a custom string as the "value" of the handle.

When I report the incoming call, and the phone is not locked, the user sees an incoming call screen, with the buttons "Remind Me", "Message", "Decline", and "Accept". If the user presses the "Message" button, and selects one of the message strings on the following menu, it tries to send that string as a text message through the Messages app, with the destination being the custom string I used as the "value" of the handle of the call, as though it were a phone number or email address, even though it isn't. This usually causes the message to fail to send due to an invalid destination, but, depending on the string, it might actually send to a valid destination the user did not want to send to; both outcomes are bad.

I am looking to see if there is a way to have the message not sent through the Messages app (which is always incorrect in my case), but instead be passed into my app so that I can send the message to the caller correctly through my internal protocol.


Update: the "Remind Me" and "Message" buttons no longer appear on iOS 10.1

like image 298
user102008 Avatar asked Sep 23 '16 20:09

user102008


1 Answers

"Message" button has appeared if support SiriKit in iOS 12. (add INSendMessageIntent to intent's info.plist)

How to intercept:

  1. Run the Intent Extension
  2. Deal with handler(for intent:)
like image 88
nathanwhy Avatar answered Sep 17 '22 03:09

nathanwhy