Class CallAction
Something the system is asking the app to do to a call: the user pressed answer on the lock screen, hung up from the car, or tapped the keypad.
Why this is an object and not just a callback
Both platforms require the app to say whether it managed to do what was
asked, and to say so within a few seconds. On iOS an unanswered
CXAction times out and the system call UI and the app then disagree
about the state of the call, permanently and with nothing in the log.
Most apps should ignore all of this: doing nothing is correct. If the
listener returns without touching the action, it is fulfilled
automatically. Only an app that has to do slow asynchronous work before it
knows whether it can answer -- renegotiating a session, say -- needs to
call defer() and then fulfill() or fail() itself.
An action that is deferred and then forgotten is failed by a safety timer rather than left to time out, because a failed action puts the system UI back in a state the user can act on, and a timed-out one does not.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddefer()Takes responsibility for answering this action later.voidfail()Reports that the app could not do what was asked, putting the system UI back into a state the user can act on.voidfulfill()Reports that the app did what was asked.The call this action is about.
-
Method Details
-
getCallId
The call this action is about. -
defer
-
fulfill
public void fulfill()Reports that the app did what was asked. -
fail
public void fail()Reports that the app could not do what was asked, putting the system UI back into a state the user can act on.
-